[issue18146] Document miss, Stats objects has no method called "print_results"

2013-06-05 Thread hanks
New submission from hanks: link: http://docs.python.org/2/library/profile.html The example in this page: import cProfile, pstats, io pr = cProfile.Profile() pr.enable() ... do something ... pr.disable() s = io.StringIO() ps = pstats.Stats(pr, stream=s) ps.print_results() # actually Stats objec

[issue16427] Faster hash implementation

2013-06-05 Thread STINNER Victor
STINNER Victor added the comment: I'm not sure that micro-benchmarks are revelant for this issue. Hash collisions may have an higher cost than the gain of a faster hash function. Some people feel also concerned by the dict denial of service issue. It would be interesting to compare performance

[issue18111] Add a default argument to min & max

2013-06-05 Thread Julian Berman
Julian Berman added the comment: Thanks for the offer Raymond. Here's a patch with some tests and doc updates, incorporating Nick's suggestion (but without a note in the docs, I didn't feel it's notable). Please let me know if anything needs tidying. -- Added file: http://bugs.python.

[issue18130] idlelib.configSectionNameDialog: fix and add tests and mocks

2013-06-05 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- resolution: -> fixed stage: commit review -> committed/rejected status: open -> closed ___ Python tracker ___

[issue16715] Get rid of IOError. Use OSError instead

2013-06-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: Now that 3.2 is off of maintenance and Idle patches are being applied to both 3.3 and 3.4 (and usually 2.7), I plan to backport the Idle subset of changes to 3.3 so patches are more likely to merge forward without incident. (I have already done one where this

[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-06-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0410bf251e10 by Richard Oudkerk in branch 'default': Issue #17931: Resolve confusion on Windows between pids and process handles. http://hg.python.org/cpython/rev/0410bf251e10 -- ___ Python tracker

[issue8902] add datetime.time.now() for consistency

2013-06-05 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- nosy: +ronaldoussoren ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

[issue8902] add datetime.time.now() for consistency

2013-06-05 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- resolution: wont fix -> status: closed -> open ___ Python tracker ___ ___ Python-bugs-list mailin

[issue17267] datetime.time support for '+' and '-'

2013-06-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am changing the title to focus this issue on arithmetics. Lack of time.now() is adressed in #8902. -- title: datetime.time support for '+' and 'now' -> datetime.time support for '+' and '-' ___ Python tracke

[issue17267] datetime.time support for '+' and 'now'

2013-06-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: See also issue 3250. If we add mod 24h arithmetics, I would like to see something like time.add_with_carry(timedelta) -> (int, time) method. With it, users who need a specific overflow behavior will be able to implement it easily: def check_add(t, td):

[issue17267] datetime.time support for '+' and 'now'

2013-06-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: This was proposed before and rejected in issue1118748, but I think current proposal addresses the ambiguity that was sited as a reason for rejection. -- nosy: +skip.montanaro ___ Python tracker

[issue17267] datetime.time support for '+' and 'now'

2013-06-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I left a few minor comments on rietveld for the last patch. I did not see code for time.now() and I don't think adding now() should be combined with time +/- timedelta patch. Let's do one thing at a time. I think time + timedelta addition is fairly unc

[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

2013-06-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Another place where PyLong_FromIntMax_t() would help, _elementtree.c: > > id = PyLong_FromSsize_t((Py_uintptr_t) self); I think PyLong_FromVoidPtr() should be used here. -- ___ Python tracker

[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-06-05 Thread STINNER Victor
STINNER Victor added the comment: -/* The size of `pid_t' (HANDLE). */ -#define SIZEOF_PID_T SIZEOF_VOID_P I would prefer to have SIZEOF_PID_T defined: #define SIZEOF_PID_T SIZEOF_INT win32_kill() uses DWORD type, not pid_t. Except these nits, your patch looks good and is more correct than my

[issue18145] Strange behavior when importing internal modules in the __init__.py of a submodule

2013-06-05 Thread Brett Cannon
Brett Cannon added the comment: It can't. The AttributeError is in the executing module code, not import itself so there is no reasonable way to tell that the failure was because of a circular loop in the import and not simply because you tried to get at an attribute that doesn't exist for som

[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

2013-06-05 Thread STINNER Victor
STINNER Victor added the comment: Another place where PyLong_FromIntMax_t() would help, _elementtree.c: id = PyLong_FromSsize_t((Py_uintptr_t) self); selectmodule.c defines PyLong_AsUintptr_t() with: #if (SIZEOF_UINTPTR_T != SIZEOF_VOID_P) # error uintptr_t does not match void *! #elif (

[issue18140] urlparse.urlsplit confused to fragment when password include #

2013-06-05 Thread Madison May
Madison May added the comment: My apologies -- that was an oversight on my part. Now that I look at the issue again, it's plain that it most likely won't be an issue. Problems only arise when you allow '#' to occur before '?' and then treat portion of the url between the '#' and '?' as a fra

[issue18145] Strange behavior when importing internal modules in the __init__.py of a submodule

2013-06-05 Thread Antoine Pietri
Antoine Pietri added the comment: Okay, maybe my message was unclear. I figured out on my own how to work around this issue (for instance using relative imports), the main problem for me is that this issue is very difficult to debug. The "import" statement should at least fail with a more expl

[issue18140] urlparse.urlsplit confused to fragment when password include #

2013-06-05 Thread Dmi Baranov
Dmi Baranov added the comment: anh, nice catch. Madison, I'm not see any terrible consequences, only urlsplit is affected now: >>> urlsplit('http://user:passw...@domain.com:80/path?query#fragment') SplitResult(scheme='http', netloc='user:passw...@domain.com:80', path='/path', query='query', fra

[issue18145] Strange behavior when importing internal modules in the __init__.py of a submodule

2013-06-05 Thread Brett Cannon
Brett Cannon added the comment: It's because you have a nested circular import. When you import package2.subpackage from within package2.subpackage you're in package2 importing package2 and also in package2.subpackage importing package2.subpackage. You can solve your problem by doing either `

[issue18145] Strange behavior when importing internal modules in the __init__.py of a submodule

2013-06-05 Thread Brett Cannon
Changes by Brett Cannon : -- versions: +Python 2.7, Python 3.4 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18145] Strange behavior when importing internal modules in the __init__.py of a submodule

2013-06-05 Thread Antoine Pietri
New submission from Antoine Pietri: I just found a very strange bug today, and it took me like two hours to figure out the problem. We first create a package "package", which contains an __init__.py, which makes an absolute import of package/foo.py (import package.foo), which makes an absolut

[issue18144] FD leak in urllib2

2013-06-05 Thread Claudio Freire
New submission from Claudio Freire: While other issues already exist about this problem, this particular case is unlike other issues, and I didn't think it a good idea to merge with those. Under some very specific circumstances (sending a POST request with more data than an unknown threshold),

[issue18130] idlelib.configSectionNameDialog: fix and add tests and mocks

2013-06-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset db4ecaf852e3 by Terry Jan Reedy in branch '3.3': Issue18130: Test class idlelib.configSectionNameDialog.GetCfgSectionNameDialog. http://hg.python.org/cpython/rev/db4ecaf852e3 New changeset 31a67a0194ec by Terry Jan Reedy in branch '2.7': Issue18130:

[issue1512124] OSX: debugger hangs IDLE

2013-06-05 Thread Ned Deily
Ned Deily added the comment: Undoubtedly, it was a bug in an earlier version of Aqua Tk; it doesn't appear to occur with current Tk's. -- resolution: accepted -> out of date stage: test needed -> committed/rejected status: open -> closed ___ Python t

[issue17085] test_socket crashes the whole test suite

2013-06-05 Thread ddve...@ucar.edu
ddve...@ucar.edu added the comment: Note that the previous patch would still let the test suite crash if the sendall() takes a short enough time. Having the test suite crash is so bad that I believe this should be the first issue to be fixed! The following patch prevents the test suite from c

[issue17085] test_socket crashes the whole test suite

2013-06-05 Thread ddve...@ucar.edu
ddve...@ucar.edu added the comment: The problem is that test_sendall_interrupted and test_sendall_interrupted_with_timeout make an assumption which is false on my hw, namely that it will take a long time for sendall() to complete. In fact, the following snippet: from timeit import default_tim

[issue18143] ssl.get_default_verify_paths()

2013-06-05 Thread Christian Heimes
Changes by Christian Heimes : Removed file: http://bugs.python.org/file30473/sslverifypath.patch ___ Python tracker ___ ___ Python-bugs-list m

[issue18143] ssl.get_default_verify_paths()

2013-06-05 Thread Christian Heimes
Christian Heimes added the comment: New patch with tests and documentation. -- Added file: http://bugs.python.org/file30476/sslverifypath2.patch ___ Python tracker ___ __

[issue18143] ssl.get_default_verify_paths()

2013-06-05 Thread Brett Cannon
Brett Cannon added the comment: That's better. As long as you use result[1::2] then the tuple is reasonable to use for the order need and still make sense as an iterable. -- ___ Python tracker

[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-05 Thread Brett Cannon
Brett Cannon added the comment: I'm going to resolve this issue myself, but "blog" about it on core-mentorship so others can follow along with how I resolve the bug. -- assignee: -> brett.cannon ___ Python tracker

[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-06-05 Thread Brett Cannon
Brett Cannon added the comment: If you look at the importlib source code in 2.7 it's actually really small and simply translates the call into an __import__ call under the hood. So __import__ can completely handle relative imports, but you were not using the level argument to __import__ nor pa

[issue18143] ssl.get_default_verify_paths()

2013-06-05 Thread Christian Heimes
Christian Heimes added the comment: How about that output, Brett? cafile is None because /usr/lib/ssl/cert.pem doesn't exist on my system. >>> import ssl >>> ssl.get_default_verify_paths() DefaultVerifyPaths(cafile=None, capath='/usr/lib/ssl/certs') >>> ssl.get_default_verify_paths(raw=True) Ra

[issue18140] urlparse.urlsplit confused to fragment when password include #

2013-06-05 Thread Madison May
Madison May added the comment: urllib.parse.urlsplit() in Python3.3 behaves the same way. Since urlsplit takes an optional param "allow_fragments", I don't think it should be a high priority issue. The relevant code from Python3.3 is below, however: if allow_fragments and '#' in url:

[issue16427] Faster hash implementation

2013-06-05 Thread Lukas Lueg
Changes by Lukas Lueg : Added file: http://bugs.python.org/file30475/cityhash_fasthast3.txt ___ Python tracker ___ ___ Python-bugs-list mailin

[issue16427] Faster hash implementation

2013-06-05 Thread Lukas Lueg
Lukas Lueg added the comment: Here are more benchmarks of vanilla 3.4 vs. cityhash vs. fast_hash_3 on both arm7l and x86-64. The patch was applied varbatim, only caching disabled. On arm7l, the cpu was fixed to maximum freq (it seems to take ages to switch frequencies, at least there is a lot

[issue18143] ssl.get_default_verify_paths()

2013-06-05 Thread Christian Heimes
Christian Heimes added the comment: I forgot that a SimpleNamespace is an unorder collection. However the order is significant. OpenSSL uses the cafile first and ignores capath if a cert in cafile matches. The path to cafile or capath is ignored when the environment key exists -- even when it

[issue18143] ssl.get_default_verify_paths()

2013-06-05 Thread Christian Heimes
Christian Heimes added the comment: Sure! I can add SimpleNamespace. The C function returns four elements: * environment var that is used to look up the path to a CA cert file * path to a CA cert file * environment var that is used to look up the path to a CA cert directory * path to a CA c

[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-06-05 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Interesting. And I can report that it works, in 2.7, with code such as b = importlib.import_module("..b", __name__) and a = importlib.import_module("..a", __name__) Still, it seems odd that a whole "importlib" is requried ot resolve the relative import,

[issue18143] ssl.get_default_verify_paths()

2013-06-05 Thread Brett Cannon
Brett Cannon added the comment: I have no clue what is being returned by this function. Any chance of using types.SimpleNamespace to give meaningful names to the returned values instead of a tuple? -- nosy: +brett.cannon ___ Python tracker

[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-06-05 Thread Brett Cannon
Brett Cannon added the comment: You use importlib.import_module to do programmatic imports (and FYI dots never go into the first argument of __import__). -- ___ Python tracker _

[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-06-05 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: One question. when doing "Programmatic" import, i.e. using the __import__ function, how do we do the same? #module foo.B A = __import__(".", fromlist=["A"]).A #module foo.A B = __import__(".", fromlist=["B"]).B Clearly the above won't work. Can we ex

[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-06-05 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: sorry, the last example really needs to be: #module foo.B A = __import__(".A", fromlist=["dummy"]) to invoke the "return final module" behaviour. Hm, maybe this simply works... I didn't test Nope, I get ValueError: Empty module name (in 2.7) --

[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-06-05 Thread Richard Oudkerk
Richard Oudkerk added the comment: Attached is a patch that adds _Py_PARSE_INTPTR and _Py_PARSE_UINTPTR to Include/longobject.h. It also uses _Py_PARSE_INTPTR in Modules/posixmodule.c and PC/msvcrtmodule.c and removes the definition for SIZEOF_PID. -- Added file: http://bugs.python.or

[issue18143] ssl.get_default_verify_paths()

2013-06-05 Thread Christian Heimes
New submission from Christian Heimes: The patch implements a get_default_verify_paths() function for the ssl module. It returns the env vars and paths that are used by openssl's set_default_verify_paths() to load CA certs from default locations. I think it makes a useful addition for debugging

[issue18142] Tests fail on Mageia Linux Cauldron x86-64 with some configure flags

2013-06-05 Thread R. David Murray
R. David Murray added the comment: This is not the sort of bug report that is likely to get much action. Our tests pass normally (we have a buildbot fleet to ensure that they do before we cut a release), so it will be necessary to figure out why they are failing for your particular setup. Pr

[issue18142] Tests fail on Mageia Linux Cauldron x86-64 with some configure flags

2013-06-05 Thread Shlomi Fish
New submission from Shlomi Fish: After I build Python-3.3.2 from the .tar.xz using the following script (on Mageia Linux Cauldron x86-64): <<< #!/bin/bash ./configure --prefix="$HOME/apps/python3" --with-threads \ --enable-ipv6 --with-dbmliborder=gdbm \ --with-sy

[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-05 Thread Brett Cannon
Brett Cannon added the comment: OK, so here was what a patch will need: * Change py_compile to raise an exception when ``not os.path.isfile(cfile) or os.path.islink(cfile)``; probably raise ValueError and mention that import itself would replace the file w/o raising an exception * Add tests *

[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-05 Thread Brett Cannon
Brett Cannon added the comment: Thanks for the clarification, Armin! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue18139] email module should have a way to prepend and insert headers

2013-06-05 Thread R. David Murray
R. David Murray added the comment: My preliminary thought (and I haven't checked the code yet to make sure this will actually work), is that under the new email policies we are dealing with full-blown header objects, meaning that they can know the header name they represent. This should theor

[issue18139] email module should have a way to prepend and insert headers

2013-06-05 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: In a somewhat similar vein, replace_header() retains the original header order. Not quite what the OP wants, but useful. The problem I had originally with a position-aware method is getting the API right. I didn't want to add a position argument to add_head

[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-05 Thread Armin Rigo
Armin Rigo added the comment: Brett: I don't really have a constructive opinion on this matter. I could suggest putting a bit more logic in py_compile.compile(cfile=...) to revert to the old behavior if we specify an already-existing target, in order to fix the other reported issue that custo

[issue18141] tkinter.Image.__del__ can throw an exception if module globals are destroyed in the wrong order

2013-06-05 Thread R. David Murray
Changes by R. David Murray : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-06-05 Thread Richard Oudkerk
Richard Oudkerk added the comment: I see _Py_PARSE_PID already exists but no others ... -- ___ Python tracker ___ ___ Python-bugs-list

[issue18139] email module should have a way to prepend and insert headers

2013-06-05 Thread R. David Murray
R. David Murray added the comment: This is by design. I agree, however, that there should be a way to do this when an application needs it, so I'm changing this to a feature request. -- components: +email nosy: +barry, r.david.murray stage: -> needs patch title: email module's add_hea

[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-06-05 Thread Richard Oudkerk
Richard Oudkerk added the comment: > @sbt: Would you like to have a strict separation between UNIX-like pid > (pid_t) and Windows process identifier (HANDLE)? Yes. And would I certainly like SIZEOF_PID_T == sizeof(pid_t) ;-) Note that _winapi takes the policy of treating HANDLE as an unsigne

[issue18141] tkinter.Image.__del__ can throw an exception if module globals are destroyed in the wrong order

2013-06-05 Thread Jan Kanis
Jan Kanis added the comment: Oops, the diff includes patches for both this issue and #18132, that should be just commit 3fdd418be9f8. -- ___ Python tracker ___ _

[issue18141] tkinter.Image.__del__ can throw an exception if module globals are destroyed in the wrong order

2013-06-05 Thread Jan Kanis
Changes by Jan Kanis : -- keywords: +patch Added file: http://bugs.python.org/file30470/3fdd418be9f8.diff ___ Python tracker ___ ___ P

[issue18141] tkinter.Image.__del__ can throw an exception if module globals are destroyed in the wrong order

2013-06-05 Thread Jan Kanis
Jan Kanis added the comment: added a fix -- hgrepos: +196 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

[issue18141] tkinter.Image.__del__ can throw an exception if module globals are destroyed in the wrong order

2013-06-05 Thread Jan Kanis
New submission from Jan Kanis: While fixing #18132 I noticed that when closing the turtledemo window an exception is thrown (and ignored) because the __del__ tries to catch a TclError exception, but the TclError global has already been deleted and set to None. I could only reproduce this in m

[issue18140] urlparse.urlsplit confused to fragment when password include #

2013-06-05 Thread Senthil Kumaran
Changes by Senthil Kumaran : -- assignee: -> orsenthil nosy: +orsenthil ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-06-05 Thread STINNER Victor
STINNER Victor added the comment: > The complication is that the return values of spawn*() etc are process > handles (cast to intptr_t), not pids: I opened this issue because of a compiler warning in os.waitpid(). On Windows, the C function _cwait() is used and it expects a intptr_t ("handle t

[issue18132] buttons in turtledemo disappear on small screens

2013-06-05 Thread Jan Kanis
Changes by Jan Kanis : -- keywords: +patch Added file: http://bugs.python.org/file30469/7cdaf0223e67.diff ___ Python tracker ___ ___ P

[issue18132] buttons in turtledemo disappear on small screens

2013-06-05 Thread Jan Kanis
Jan Kanis added the comment: I've created a patch, replacing the packed layout by a gridded layout -- hgrepos: +195 ___ Python tracker ___ ___

[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-06-05 Thread Richard Oudkerk
Richard Oudkerk added the comment: > pid_t is HANDLE on Windows, which is a pointer. I think this is wrong. The signature of getpid() is int _getpid(void); so pid_t should be equivalent to int. The complication is that the return values of spawn*() etc are process handles (cast to intpt

[issue1512124] OSX: debugger hangs IDLE

2013-06-05 Thread Ronald Oussoren
Ronald Oussoren added the comment: The problem appears to be gone in current releases (at least on OSX 10.8 with Tk 8.5) and I therefore propose to close the issue. -- nosy: +ned.deily ___ Python tracker ___

[issue18136] test_distutils failing under OS X 10.8 w/ clang

2013-06-05 Thread Ronald Oussoren
Ronald Oussoren added the comment: Does the compiler use the correct header files? The error messages seem to indicate that the 2.7 headers are used instead of the 3.4 ones (all missing identifiers were introduced in py3k and are not in 2.x) FWIW, the distutils tests work fine on my machine (O

[issue4331] Add functools.partialmethod

2013-06-05 Thread Matt Joiner
Matt Joiner added the comment: This sounds excellent Nick. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue18135] _ssl module: possible integer overflow for very long strings (+2^31 bytes)

2013-06-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The patch contains a lot of unrelated trailing spaces changes. Could you please commit they separately? See also issue15550. -- ___ Python tracker __

[issue18140] urlparse.urlsplit confused to fragment when password include #

2013-06-05 Thread anh le
New submission from anh le: >>> u = 'http://auser:secr#et@192.168.0.1:8080/a/b/c.html' >>> urlparse.urlsplit(u) SplitResult(scheme='http', netloc='auser:secr', path='', query='', fragment='et@192.168.0.1:8080/a/b/c.html') -- components: Library (Lib) messages: 190646 nosy: anh.le priori

[issue4331] Add functools.partialmethod

2013-06-05 Thread Nick Coghlan
Nick Coghlan added the comment: Any associated tests may also want check that wrapping classmethod around a partialmethod generates a well behaved class method, and ditto for property. If singledispath, classmethod, partialmethod and class and instance attribute access all work correctly, then

[issue18136] test_distutils failing under OS X 10.8 w/ clang

2013-06-05 Thread Ned Deily
Ned Deily added the comment: Brett, what configure options are you using and what version of clang? I don't see these errors with the current Apple clang (Xcode 4.6.2): $ clang --version Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn) Target: x86_64-apple-darwin12.4.0 Thread mo