[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
New submission from Trung Doan: In Python 2.5.4's config-main.cfg file, if [EditorWindow]'s width and height are left blank or set to zero, then IDLE window won't show. Uninstalling and re-installing Python didn't help. Problem solved only when the config-main.cfg file was manually edited to give non-zero values. -- components: IDLE messages: 175979 nosy: doanviettrung priority: normal severity: normal status: open title: IDLE configuration file: blank height and width fields trip up IDLE type: crash versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: [issue16500] Add an 'afterfork' module
2012/11/20 Christian Heimes rep...@bugs.python.org IFF we are going to walk the hard and rocky road of exception handling, then we are going to need at least four hooks and a register function that takres four callables as arguments: register(prepare, error, parent, child). Each prepare() call pushes an error handling onto a stack. In case of an exception in a prepare handler, the error stack is popped until all error handlers are called. This approach allows a prepare handler to actually prevent a fork() call from succeeding. FWIW, PyPy already has a notion of fork hooks: https://bitbucket.org/pypy/pypy/src/b4e4017909bac6c102fbc883ac8d2e42fa41553b/pypy/module/posix/interp_posix.py?at=default#cl-682 Various subsystems (threads cleanup, import lock, threading.local...) register their hook functions. You may want to experiment from there :-) A new atfork module would be easy to implement. -- Amaury Forgeot d'Arc ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Kristján Valur Jónsson added the comment: Antoine, I understand that _you_ may not see any need for object references in marshal streams. Also, I am not going to try to convince you it is a good idea, since I have long figured out that you are against any contributions from me on some sort of principle. However, even if you cannot agree that it is a good idea, can you explain to me how it is a BAD idea? How can expanding object references to strings to all objects, using the same mechanism, be bad? How can it be bad to make the marshal format more complete with minimal effort? Keep in mind that this change removes a number of warnings and caveats present both in the documentation and the in-line comments. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Mark Dickinson added the comment: I have long figured out that you are against any contributions from me on some sort of principle. I suspect that Antoine's principles have very little to do with *who* the contributions originate from, and much more to do with the content of those contributions. We've all got the same overarching goal of improving and maintaining the quality of Python. Please can we not make this personal? -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Kristján Valur Jónsson added the comment: Serhiy, to answer your questions: Can you please measure the time of unmarshalling? Sure. Normally, I wouldn't consider time to be important here because for code objects, unmarshaling is done only once per run However, testing it is simple: I added timeit(number=100) for unmarshaling of the different version code. 0.09614 0.09605 0.582672 0.553599 0.05590 0.05628 0.293370 0.285517 0.05703 0.05754 0.294601 0.292070 The lines are version 2, 3, and 4(*) respectively. The columns are test_marshal.py, recode.intern(test_marshal.py), decimal.py and recode.intern(decimal.py) As you see, loading time is almost halfed with version 3 and 4 compared to 2. Version 3 is also slightly faster than 4 (*)verion 4 is a special version that only instances strings. If you can count the statistics about marshalled types (what percent of shared and non shared integers, strings, etc), it would also be very interesting. That's more tricky, at least on a type=by-type basis, but I could do a global object count. Later. There is at least one reason. This increases size of the refs table. I checked this, by printing out the size of the instance list when loads() was done: 457 1571 297 1163 429 1539 The columns are test_marshal.py and decimal.py the lines are version 3, version 4( only strings ) and special version5 which is like 3 but omits ints. As you see, the ints correspond to roughly 6% and 2% of the instances respectively. The bulk of the list is taken up by strings (65% and 74%) This shows that adding instancing of all other types on top of the strings does not typically expand the instance list more than 50% -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
New submission from Joril: imghdr doesn't support jpegs that include an ICC Profile. This is because imghdr looks for JFIF somewhere at the beginning of the file, but the ICC_PROFILE shifts that further. (The ICC spec is here http://www.color.org/specification/ICC1v43_2010-12.pdf, annex B) -- files: peanuts15.jpg messages: 175984 nosy: joril priority: normal severity: normal status: open title: imghdr doesn't support jpegs with an ICC profile type: enhancement versions: Python 2.7 Added file: http://bugs.python.org/file28046/peanuts15.jpg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
Ezio Melotti added the comment: Can you provide a patch? -- nosy: +ezio.melotti stage: - needs patch versions: +Python 3.4 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
Joril added the comment: I can try, yes. I'll add one ASAP -- versions: +Python 2.7 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Kristján Valur Jónsson added the comment: New patch, incorporating suggested fixes from review. -- Added file: http://bugs.python.org/file28047/marshalinstance.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Serhiy Storchaka added the comment: Thank you, Kristján, for the statistics. It makes your proposition more attractive. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Kristján Valur Jónsson added the comment: New patch with changes. -- Added file: http://bugs.python.org/file28048/marshalinstance.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16513] SGMLParser processing tr which include two a will have problem
Ezio Melotti added the comment: Have you tried with HTMLParser? sgmllib is deprecated and has been removed in Python 3. HTMLParser is also much better at parsing (broken) HTML. -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16513 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Mark Dickinson added the comment: Thanks for the bug report. Are you in a position to test whether this is still an issue for Python 2.7? (Python 2.5 is no longer maintained.) -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16513] SGMLParser processing tr which include two a will have problem
moonflow added the comment: I haven't tried it, the problem will not process? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16513 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16513] SGMLParser processing tr which include two a will have problem
Ezio Melotti added the comment: If what you are trying to do is extracting the link(s) that contain 'cve', you try the attached script. -- Added file: http://bugs.python.org/file28050/issue16513.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16513 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16500] Add an 'afterfork' module
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16500 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16513] SGMLParser processing tr which include two a will have problem
Ezio Melotti added the comment: Sorry, I misread your code, looks like you want the href *without* 'cve'. In that case change my code to use 'cve' not in attrs['href'] (also avoid using s.find('cve') == -1 , and use the more readable and idiomatic 'cve' not in s ). I think your original script doesn't work for two reasons: 1) you are looking for a table with class=tablesorter, but in the HTML the table doesn't have that class, so self.is_table is never set to True; 2) you are finding the href of the a with a style attribute and correctly setting it to self.href_name, but the value is then replaced by when the following a without style is found; That said, I still suggest you to abandon sgmllib and use HTMLParser, or possibly an external module like BeautifulSoup or LXML. -- resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16513 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16500] Add an 'afterfork' module
Changes by Amaury Forgeot d'Arc amaur...@gmail.com: -- nosy: +amaury.forgeotdarc -Amaury.Forgeot.d'Arc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16500 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
New submission from Barry A. Warsaw: When sys.path[0] is None, attempting to import a module produces a cryptic chained traceback. This is a regression from 3.2 where the import would succeed. The basic issue is that in 3.2's import.c, non-string/bytes items on sys.path are essentially ignored (see the loop in import.c:1708 find_module()) while they are not ignored in 3.3's importlib. This means that because zipimporter.zipimiporter is by default the first thing on sys.path_hooks, zipimporter.zipimporter(None) gets called. This raises a TypeError which starts the chained exception. Note that the fact that zipimporter.zipimporter(None) raises a TypeError is *not* a regression. The regression is that None makes its way to sys.path_hooks at all. I think this will be relatively easy to fix, if we agree that the current regressive behavior is a bug. -- assignee: barry components: Interpreter Core keywords: 3.3regression messages: 175996 nosy: barry priority: high severity: normal status: open title: Cryptic traceback when sys.path[0] is None type: behavior versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16500] Add an 'afterfork' module
Richard Oudkerk added the comment: IFF we are going to walk the hard and rocky road of exception handling, then we are going to need at least four hooks and a register function that takres four callables as arguments: register(prepare, error, parent, child). Each prepare() call pushes an error handling onto a stack. In case of an exception in a prepare handler, the error stack is popped until all error handlers are called. This approach allows a prepare handler to actually prevent a fork() call from succeeding. I think there are two main options if a prepare callback fails: 1) The fork should not occur and the exception should be raised 2) The fork should occur and the exception should be only be printed I favour option 1 since, if they want, users can always wrap their prepare callbacks with try: ... except: sys.excepthook(*sys.exc_info()) With option 1 I don't see why error callbacks are necessary. Just unwind the stack of imaginary try...finally... clauses and let any exceptions propagate out using exception chaining if necessary. This is what pure-python-atfork.patch does. Note, however, that if the fork succeeds then any subsequent exception is only printed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16500 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Serhiy Storchaka added the comment: Personally I don't like the use of macros inn this code. I think that without them the code would be clearer. If anyone is interested, here are the statistics for all the standard modules (Lib/__pycache__/*.pyc). UNICODE 105248 61% TUPLE33193 19% STRING 13527 7.8% INT 7373 4.3% CODE 6438 3.7% NONE 5291 3.1% TRUE 474 0.27% FALSE 401 0.23% BINARY_FLOAT 340 0.2% LONG60 0.035% FROZENSET 20 0.012% Strings (unicode and bytes), tuples, short ints, code objects and None in sum are 99% of all objects. Mutable collections, complex numbers, Ellipsis and StopIteration are not used at all. If size of compiled modules is a problem, we can get about 10% by using more compact representation for sizes (1- or 2-bytes). This requires additional codes for strings and collections (at least for unicode strings and tuples). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8713] multiprocessing needs option to eschew fork() under Linux
Richard Oudkerk added the comment: http://hg.python.org/sandbox/sbt#spawn now contains support for starting processes via a separate server process. This depends on fd passing support. This also solves the problem of mixing threads and processes, but is much faster than using fork+exec. It seems to be just as fast as using plain fork. I have tested it successfully on Linux and a MacOSX buildbot. (OpenSolaris does not seem to support fd passing.) At the begining of your program you write multiprocessing.set_start_method('forkserver') to use the fork server. Alternatively you can use multiprocessing.set_start_method('spawn') to use _posixsubprocess.fork_exec() with closefds=True on Unix or multiprocessing.set_start_method('fork') to use the standard fork method. This branch also stops child processes on Windows from automatically inheriting inheritable handles. The test suite can be run with the different start methods by doing python -m test.test_multiprocessing_fork python -m test.test_multiprocessing_spawn python -m test.test_multiprocessing_forkserver -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Barry A. Warsaw added the comment: Patch for 3.3, omitting the requisite importlib.h change. -- keywords: +patch Added file: http://bugs.python.org/file28051/16514.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Barry A. Warsaw added the comment: Oh, the patch includes the removal of some unused imports from test_path.py, thanks to pyflakes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +brett.cannon, eric.smith, eric.snow, jason.coombs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Kristján Valur Jónsson added the comment: Changes as suggested by Serhiy -- Added file: http://bugs.python.org/file28052/marshalinstance.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16500] Add an 'afterfork' module
Christian Heimes added the comment: Amaury: PyPy doesn't handle exceptions in hooks. Is there a reason why PyPy goes for the simplistic approach? Richard: An error callback has the benefit that the API can notice the hooks that some error has occurred. We may not need it, though. I can think of six exception scenarios that must be handled: (1) exception in a prepare hook - don't call the remaining prepare hooks, run all related parent hooks in FILO order, prevent fork() call (2) exception in parent hook during the handling of (1) - print exception, continue with next parent hook (3) exception in fork() call - run parent hooks in FILO order (4) exception in parent hook during the handling of (3) - print exception, continue with next parent hook (5) exception in parent hook when fork() has succeeded - print exception, continue with next parent hook (6) exception in child hook when fork() has succeeded - print exception, continue with next child hook Do you agree? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16500 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16500] Add an 'afterfork' module
Amaury Forgeot d'Arc added the comment: PyPy doesn't handle exceptions in hooks. Is there a reason why PyPy goes for the simplistic approach? Probably because nobody thought about it. At the moment, there is only one 'before', one 'parent' hook (so the FILO order is simple), and three 'child' hooks. And if the _PyImport_ReleaseLock call fails, you'd better not ignore the error... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16500 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Kristján Valur Jónsson added the comment: The size of the .pyc files is secondary. The size that is important is the memory footprint of loaded code objects, which can be done by stripping and folding code objects. This works springs out of work for embedding python on the PS3 console where every byte counts. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Eric V. Smith added the comment: I agree it's a bug. And the fix looks good to me. Having said that: I haven't looked at the import.c version to verify what is happening. Does the test pass under 3.2? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16382] Better warnings exception for bad category
Changes by Phil Elson pelson@gmail.com: Added file: http://bugs.python.org/file28053/pelson_warnings_fix_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16382 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Barry A. Warsaw added the comment: Oh, btw, I intend to add documentation that makes explicit: * sys.path entries must be strings or bytes, everything else is ignored * path importers should expect strings or bytes * the encoding of bytes is left to the individual path hooks to define, however it it can't decode the bytes it should ignore the path entry or raise an ImportError (effectively ignoring it anyway). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Antoine Pitrou added the comment: However, even if you cannot agree that it is a good idea, can you explain to me how it is a BAD idea? How can expanding object references to strings to all objects, using the same mechanism, be bad? It is a bad idea because features have to be supported in the long-term, which means more maintenance effort. So, basically, this is the same reason we don't accept every feature request + patch that gets posted to the tracker. And, again, I think the string interning part is a good thing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
Joril added the comment: Here it is... It is against the latest hg version, should I write one for 2.7 too? -- keywords: +patch Added file: http://bugs.python.org/file28054/imghdr_icc_jpeg.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
Ezio Melotti added the comment: Thanks for the patch. should I write one for 2.7 too? Not necessary, 2.7 only gets bugs fixes. OTOH it would be nice to have some tests for this new features (and for the module in general), but there doesn't seem to be any Lib/test/test_imghdr.py file. The module itself seems to contain some kind of tests at the end though. -- components: +Library (Lib) stage: needs patch - patch review versions: +Python 3.4 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- nosy: +chris.jerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Antoine Pitrou added the comment: By the way, please follow PEP 8 in test_marshal.py. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Serhiy Storchaka added the comment: Here is the statistics for all pyc-files (not only in Lib/__pycache__). This includes encoding tables and tests. I count also memory usage for some types (for tuples shared size is estimated upper limit). type count % size shared % UNICODE 622812 58%26105085 14885090 57% TUPLE 224214 21% 8184848 3498300 43% STRING 90992 8.4%6931342 832224 12% INT 52087 4.8% 71540058666 8.2% CODE 42147 3.9%28659960 0% NONE 39777 3.7% BINARY_FLOAT 3120 0.29% TRUE 2363 0.22% FALSE 1976 0.18% LONG 1012 0.094% ELLIPSIS 528 0.049% BINARY_COMPLEX 465 0.043% FROZENSET 24 0.0022% Total 1081517 100% 44802671 19274280 ~43% Yet some statistics. If we import all standard modules, we can save using object sharing 2.3 MB of total 4.6 MB (50%) memory size for unicode objects, up to 0.47 MB of 1.25 MB for tuples (approximate upper limit), 84 KB of 117 KB (7%) for bytes objects, and only 2 KB of 101 KB for integers (most integers already interned). None of code objects can be shared (because code object contains almost unique first line number). Therefore there is a sense to share unicode objects, tuples, and may be bytes objects. Most integers (in range -5..257) already interned. None of code objects can be shared (because code object contains almost unique first line number). Floats, complexes and frozensets unlikely save much of memory. -- Added file: http://bugs.python.org/file28055/marshalstat.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Serhiy Storchaka added the comment: Here is the statistics for all pyc-files (not only in Lib/__pycache__). This includes encoding tables and tests. I count also memory usage for some types (for tuples shared size is estimated upper limit). type count % size shared % UNICODE 622812 58%26105085 14885090 57% TUPLE 224214 21% 8184848 3498300 43% STRING 90992 8.4%6931342 832224 12% INT 52087 4.8% 71540058666 8.2% CODE 42147 3.9%28659960 0% NONE 39777 3.7% BINARY_FLOAT 3120 0.29% TRUE 2363 0.22% FALSE 1976 0.18% LONG 1012 0.094% ELLIPSIS 528 0.049% BINARY_COMPLEX 465 0.043% FROZENSET 24 0.0022% Total 1081517 100% 44802671 19274280 ~43% Therefore there is a sense to share unicode objects, tuples, and may be bytes objects. Most integers (in range -5..257) already interned. None of code objects can be shared (because code object contains almost unique first line number). Floats, complexes and frozensets unlikely save much of memory. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Changes by Serhiy Storchaka storch...@gmail.com: -- Removed message: http://bugs.python.org/msg176012 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Antoine Pitrou added the comment: Here is the statistics for all pyc-files (not only in Lib/__pycache__). This includes encoding tables and tests. I count also memory usage for some types (for tuples shared size is estimated upper limit). Did you examine the sharing per file or among all files? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Serhiy Storchaka added the comment: Per file. With total sharing: UNICODE 622812 58%26105085 18262484 70% TUPLE 224214 21% 8184848 4007404 49% STRING 90992 8.4%6931342 1361618 20% INT 52087 4.8% 71540095666 13% CODE 42147 3.9%28659960 0% -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Serhiy Storchaka added the comment: Total size of all *.pyc files is 22 MB. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Martin v. Löwis added the comment: Am 20.11.12 17:32, schrieb Kristján Valur Jónsson: The size of the .pyc files is secondary. This really depends on whom you ask. When I did the string interning support, the primary concern *was* for the size of the pyc files, and there *was* a real project where it mattered (namely, code size in a frozen application). It may be secondary to *you* and *now*. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16475] Support object instancing and recursion in marshal
Martin v. Löwis added the comment: Am 20.11.12 18:02, schrieb Antoine Pitrou: It is a bad idea because features have to be supported in the long-term, which means more maintenance effort. So, basically, this is the same reason we don't accept every feature request + patch that gets posted to the tracker. For marshal, this actually is of less concern - we are free to change it whenever we please (and people actually did change it when they pleased). Of course, there still must be a demonstrated gain, and that must be significant enough to justify the size of the change (in diffstat). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16500] Add an 'afterfork' module
Gregory P. Smith added the comment: I think you are solving a non-problem if you want to expose exceptions from such hooks. Nobody needs it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16500 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16500] Add an 'afterfork' module
Antoine Pitrou added the comment: I think you are solving a non-problem if you want to expose exceptions from such hooks. Nobody needs it. Agreed. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16500 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path
Barry A. Warsaw added the comment: On Nov 20, 2012, at 04:51 PM, Eric V. Smith wrote: I agree it's a bug. And the fix looks good to me. Thanks. Having said that: I haven't looked at the import.c version to verify what is happening. Does the test pass under 3.2? Yep. See below. When you take a look at the path_hooks iteration loop, you'll see why. -snip snip- import sys sys.path.insert(0, None) sys.path_importer_cache.pop(None, None) sys.modules.pop('email', None) import email print(email) -snip snip- % python3.2 /tmp/foo.py module 'email' from '/usr/lib/python3.2/email/__init__.py' % python3.3 /tmp/foo.py Traceback (most recent call last): File frozen importlib._bootstrap, line 1271, in _path_importer_cache KeyError: None During handling of the above exception, another exception occurred: Traceback (most recent call last): File /tmp/foo.py, line 7, in module import email File frozen importlib._bootstrap, line 1561, in _find_and_load File frozen importlib._bootstrap, line 1519, in _find_and_load_unlocked File frozen importlib._bootstrap, line 1473, in _find_module File frozen importlib._bootstrap, line 1308, in find_module File frozen importlib._bootstrap, line 1284, in _get_loader File frozen importlib._bootstrap, line 1273, in _path_importer_cache File frozen importlib._bootstrap, line 1254, in _path_hooks TypeError: 'NoneType' object is not iterable Error in sys.excepthook: Traceback (most recent call last): File frozen importlib._bootstrap, line 1271, in _path_importer_cache KeyError: None During handling of the above exception, another exception occurred: Traceback (most recent call last): File /usr/lib/python3/dist-packages/apport_python_hook.py, line 58, in apport_excepthook from cStringIO import StringIO File frozen importlib._bootstrap, line 1561, in _find_and_load File frozen importlib._bootstrap, line 1519, in _find_and_load_unlocked File frozen importlib._bootstrap, line 1473, in _find_module File frozen importlib._bootstrap, line 1308, in find_module File frozen importlib._bootstrap, line 1284, in _get_loader File frozen importlib._bootstrap, line 1273, in _path_importer_cache File frozen importlib._bootstrap, line 1254, in _path_hooks TypeError: 'NoneType' object is not iterable Original exception was: Traceback (most recent call last): File frozen importlib._bootstrap, line 1271, in _path_importer_cache KeyError: None During handling of the above exception, another exception occurred: Traceback (most recent call last): File /tmp/foo.py, line 7, in module import email File frozen importlib._bootstrap, line 1561, in _find_and_load File frozen importlib._bootstrap, line 1519, in _find_and_load_unlocked File frozen importlib._bootstrap, line 1473, in _find_module File frozen importlib._bootstrap, line 1308, in find_module File frozen importlib._bootstrap, line 1284, in _get_loader File frozen importlib._bootstrap, line 1273, in _path_importer_cache File frozen importlib._bootstrap, line 1254, in _path_hooks TypeError: 'NoneType' object is not iterable -- title: Cryptic traceback when sys.path[0] is None - Cryptic traceback when sys.path ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16500] Add an 'afterfork' module
Christian Heimes added the comment: Your suggestion is that the hooks are called as: for hook in hooks: try: hook() except: try: sys.excepthook(*sys.exc_info()) except: pass That makes the implementation much easier. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16500 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Changes by Barry A. Warsaw ba...@python.org: -- title: Cryptic traceback when sys.path - Cryptic traceback when sys.path[0] is None ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Roger Serwy added the comment: This is still a bug with 2.7 and 3.4. I just tried leaving the width and height fields in config-main.cfg and IDLE had raised the error: _tkinter.TclError: expected integer but got The width and height keys in the text_options dictionary in EditorWindow.py are set to blank strings instead of a number of a number as a string. IDLE not showing up is a symptom of issue13582. -- nosy: +serwy versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Serhiy Storchaka added the comment: When width or height are 0, IDLE starts and show window with some minimal width or height. When width or height are empty or invalid IDLE can't start. The proposed patch makes IDLE more resistant against such broken configs. -- keywords: +patch nosy: +kbk, serhiy.storchaka versions: -Python 2.6, Python 3.1 Added file: http://bugs.python.org/file28056/idle_safe_getoption.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Roundup Robot added the comment: New changeset 291406748217 by Barry Warsaw in branch '3.3': - Issue #16514: Fix regression causing a traceback when sys.path[0] is None http://hg.python.org/cpython/rev/291406748217 New changeset a82ee9a1457a by Barry Warsaw in branch 'default': - Issue #16514: Fix regression causing a traceback when sys.path[0] is None http://hg.python.org/cpython/rev/a82ee9a1457a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Roger Serwy added the comment: Serhiy, I applied your patch and it works. However, the initial window size in IDLE Preferences-General are listed as None instead of a number. Perhaps if the userCfg has an invalid value then the defaultCfg should be returned? -- versions: +Python 2.6, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Roger Serwy added the comment: Changed from Crash to Behavior, as the interpreter is not crashing. Also undid my mistake of re-adding 2.6 and 3.1. -- type: crash - behavior versions: -Python 2.6, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16514] Cryptic traceback when sys.path[0] is None
Changes by Barry A. Warsaw ba...@python.org: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16514 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Serhiy Storchaka added the comment: Perhaps if the userCfg has an invalid value then the defaultCfg should be returned? Yes, you are right. Thanks for suggestion. -- Added file: http://bugs.python.org/file28057/idle_safe_getoption_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file28056/idle_safe_getoption.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1160] Medium size regexp crashes python
Roundup Robot added the comment: New changeset 10314c9b7c5a by Antoine Pitrou in branch '2.7': Issue #1160: Fix compiling large regular expressions on UCS2 builds. http://hg.python.org/cpython/rev/10314c9b7c5a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1160 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1160] Medium size regexp crashes python
Roundup Robot added the comment: New changeset a3579d766fb6 by Antoine Pitrou in branch '3.2': Issue #1160: Fix compiling large regular expressions on UCS2 builds. http://hg.python.org/cpython/rev/a3579d766fb6 New changeset 8b73a069ae4f by Antoine Pitrou in branch '3.3': Merge test from issue #1160. http://hg.python.org/cpython/rev/8b73a069ae4f New changeset 10c1f9e05f4f by Antoine Pitrou in branch 'default': Merge test from issue #1160. http://hg.python.org/cpython/rev/10c1f9e05f4f -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1160 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1160] Medium size regexp crashes python
Antoine Pitrou added the comment: I've committed the patch to 3.2 and 2.7, and added the test to 3.3 and default. Thank you! -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1160 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16511] IDLE configuration file: blank height and width fields trip up IDLE
Serhiy Storchaka added the comment: Patch updated. Added warning for case when user config broken. Thanks Roger for suggestion. -- Added file: http://bugs.python.org/file28058/idle_safe_getoption_3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16511 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14525] ia64-hp-hpux11.31 won't compile Python-2.6.8rc2 without -D_TERMIOS_INCLUDED
Paul A. added the comment: On Sun, Nov 18, 2012 at 08:01:39PM +, Terry J. Reedy wrote: I should have added 'please try compiling 3.x to make sure it has the same problem' since configure might behave differently. I'm fairly sure I did, that was quite a few months ago, so my memory could be faulty. I did eventually get both of 2.6.7 and 2.7.3 built, I really must submit my patches. I suppose it should go against the current 2.7 in the repo, correct? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14525 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16515] TypeError message incorrect for max() with no args
New submission from Chris Jerdonek: The below should probably say something along the lines of max expected 1 positional arguments (since the foo value is an argument): max(foo=1) Traceback (most recent call last): File stdin, line 1, in module TypeError: max expected 1 arguments, got 0 I imagine this affects other functions, but I haven't looked into which ones. Here is an example of another built-in function that provides a better message: sorted(foo=1) Traceback (most recent call last): File stdin, line 1, in module TypeError: Required argument 'iterable' (pos 1) not found -- components: Interpreter Core messages: 176034 nosy: chris.jerdonek priority: normal severity: normal status: open title: TypeError message incorrect for max() with no args type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14525] ia64-hp-hpux11.31 won't compile 2.7 without -D_TERMIOS_INCLUDED
Terry J. Reedy added the comment: Yes, and ditto for 3.x if the patch needs to be altered. -- title: ia64-hp-hpux11.31 won't compile Python-2.6.8rc2 without -D_TERMIOS_INCLUDED - ia64-hp-hpux11.31 won't compile 2.7 without -D_TERMIOS_INCLUDED ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14525 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14525] ia64-hp-hpux11.31 won't compile 2.7 without -D_TERMIOS_INCLUDED
Stefan Krah added the comment: I think I fixed this yesterday in #6308. Please try with a current 2.7, 3.3 or 3.4 clone. -- nosy: +skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14525 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16480] pyvenv 3.3 fails to create symlinks for virtualenv/local/{bin, lib} to virtualenv/{bin, lib}
Carl Meyer added the comment: Here is the bug filed against virtualenv that led to the addition of the local/ directory: https://github.com/pypa/virtualenv/issues/118 As Vinay pointed out, the original fix was later modified to be friendlier to tools that dislike recursive symlinks. That's about all I know; I don't know if any of this is still needed in 3.3/3.4. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16480 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16515] TypeError message incorrect for max() with one keyword arg
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- title: TypeError message incorrect for max() with no args - TypeError message incorrect for max() with one keyword arg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16491] try-except-raise-bug
Hans Larsen added the comment: -Oprindelig meddelelse- From: Martin v. Löwis Sent: Saturday, November 17, 2012 2:45 PM To: jo...@mail.dk Subject: [issue16491] try-except-raise-bug Martin v. Löwis added the comment: That looks like a bug/missing feature in PythonWin to me, which doesn't print __context__ properly. Note: I haven't tested PythonWin to confirm. Hans: is the output also incorrect in IDLE, or a command line shell? If no, then this isn't a bug in Python itself, but one in PythonWin. You can find the bug tracker at http://sourceforge.net/projects/pywin32/ Ramchandra: the bug report actually *is* in English, starting with I has found The first part is just Hans' postal address (which we don't really need here, but it doesn't hurt having it, either). I have tried it in Python IDLE, but it's the samme except that returns a TypeError instead! -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16491 ___ -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16491 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13538] Improve doc for str(bytesobject)
Roundup Robot added the comment: New changeset f32f1cb508ad by Chris Jerdonek in branch '3.2': Improve str() and object.__str__() documentation (issue #13538). http://hg.python.org/cpython/rev/f32f1cb508ad New changeset 6630a1c42204 by Chris Jerdonek in branch '3.3': Null merge from 3.2 (issue #13538). http://hg.python.org/cpython/rev/6630a1c42204 New changeset 325f80d792b9 by Chris Jerdonek in branch '3.3': Improve str() and object.__str__() documentation (issue #13538). http://hg.python.org/cpython/rev/325f80d792b9 New changeset 59acd5cac8b5 by Chris Jerdonek in branch 'default': Merge from 3.3: Improve str() and object.__str__() docs (issue #13538). http://hg.python.org/cpython/rev/59acd5cac8b5 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13538 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13538] Improve doc for str(bytesobject)
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13538 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16516] argparse types (and actions) must be hashable
New submission from Joel Nothman: The argparse documentation states that type= can take any callable that takes a single string argument and returns the converted value. The following is an exception: import argparse ap = argparse.ArgumentParser() ap.add_argument('foo', type={}.get) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3/argparse.py, line 1294, in add_argument type_func = self._registry_get('type', action.type, action.type) File /usr/lib/python3/argparse.py, line 1236, in _registry_get return self._registries[registry_name].get(value, default) TypeError: unhashable type: 'dict' Sadly, a method bound to an unhashable type is unhashable! (Of course, is trivial to use partial or lambda to make any function hashable.) The offending line in _registry_get is intended to look up named types (or actions), so it perhaps only relevant for string type= and action= values, which could be handled explicitly instead of using dict.get(x, x) to handle both cases. Alternatively, the TypeError could be caught and default returned. -- components: Library (Lib) messages: 176040 nosy: bethard, jnothman priority: normal severity: normal status: open title: argparse types (and actions) must be hashable type: behavior versions: Python 2.7, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16516 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16517] address merge conflicts in devguide null-merge instructions
New submission from Chris Jerdonek: The null-merge instructions in the devguide (in the note box in the section linked to below): http://docs.python.org/devguide/committing.html#porting-within-a-major-version are incomplete if the merge created conflicts. It would help to include instructions on how to resolve this scenario. Proposed patch attached. (Am I right that the `hg resolve` is required?) [Also adding David since this or a related topic came up with him on IRC a couple(?) months back.] -- assignee: chris.jerdonek components: Devguide files: issue-null-merge-1.patch keywords: easy, patch messages: 176041 nosy: chris.jerdonek, eric.araujo, ezio.melotti, ncoghlan, r.david.murray priority: normal severity: normal stage: patch review status: open title: address merge conflicts in devguide null-merge instructions type: enhancement Added file: http://bugs.python.org/file28059/issue-null-merge-1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16517 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16518] add buffer protocol to glossary
New submission from Chris Jerdonek: This issue is to add buffer protocol (or perhaps buffer object) to the glossary. The concept is currently described here: http://docs.python.org/dev/c-api/buffer.html#buffer-protocol Éric initially suggested doing this in the comments to issue 13538. Such a glossary entry would be useful because the buffer protocol (or buffer object) should likely be cited, for example, wherever a function accepts a bytes object, bytearray object, or any object that supports the buffer protocol. The str() constructor is one example where this is done: http://hg.python.org/cpython/file/59acd5cac8b5/Doc/library/functions.rst#l1275 Buffer object might be the more useful term to add to the glossary because it would help to have a briefer way of saying any object that supports the buffer protocol. (I'm assuming this is what buffer object actually means.) The patch for this issue should also do a comprehensive review of occurrences of buffer object/protocol throughout the docs and add or update links and index entries where appropriate. -- assignee: docs@python components: Documentation messages: 176042 nosy: chris.jerdonek, docs@python, eric.araujo, ezio.melotti, pitrou priority: normal severity: normal status: open title: add buffer protocol to glossary type: enhancement versions: Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16518 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16519] site.venv() should use abspath(executable)
New submission from Christian Heimes: While I was testing #16499 I found a small bug in the venv code of the site module. The code in site.venv() doesn't use abspath() to sanitize the path to executable_dir. This leads to wrong behavior when a venv is created in the root of a hg checkout and the non-venv interpreter is called with a relative path: (venv) heimes@hamiller:~/dev/python/cpython/venv$ ../python -c import sys; print(sys.path) ['', '/usr/local/lib/python34.zip', '/home/heimes/dev/python/cpython/Lib', '/home/heimes/dev/python/cpython/Lib/plat-linux', '/home/heimes/dev/python/cpython/build/lib.linux-x86_64-3.4-pydebug', '/home/heimes/dev/python/cpython/venv/lib/python3.4/site-packages'] The fix is simple, straight forward and totally harmless: --- a/Lib/site.py +++ b/Lib/site.py @@ -484,7 +484,7 @@ executable = os.environ['__PYVENV_LAUNCHER__'] else: executable = sys.executable -executable_dir, executable_name = os.path.split(executable) +executable_dir, executable_name = os.path.split(os.path.abspath(executable)) site_prefix = os.path.dirname(executable_dir) sys._home = None if sys.platform == 'win32': -- components: Interpreter Core messages: 176043 nosy: christian.heimes priority: normal severity: normal status: open title: site.venv() should use abspath(executable) type: behavior versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16519 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com