[issue16423] urllib data URL
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - patch review versions: -Python 3.1, Python 3.2, Python 3.3, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16470] Backport set and dictionary comprehensions in tutorial to 2.7
Yongzhi Pan added the comment: I updated the patch according to the code review. Hope now it is OK. -- Added file: http://bugs.python.org/file27995/set_and_dict_comprehensions_1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16470 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16483] Make int(float('inf')) raise ValueError rather than OverflowError.
Mark Dickinson added the comment: I guess the feeling of wrongness for me mostly comes from the floating-point world, where the IEEE 754 'overflow' floating-point exception is only appropriate for cases where the result is *finite* but so large that it falls outside the representable range for a float. Regarding conversions from floating-point formats to integer formats, IEEE 754 says: When a NaN or infinite operand cannot be represented in the destination format and this cannot otherwise be indicated, the invalid operation exception shall be signaled. To the extent that there's a convention at all, we typically map 'invalid operation exceptions' to ValueError. (See the comments at the top of Modules/mathmodule.c.) There's also the minor practical inconvenience of having to remember to catch OverflowError *and* ValueError in try: .. except: constructs. On the other side, there's a very real possibility of breaking code with this change. I'll leave this open for a week or so, but unless there's a strong consensus that this should be changed, I propose to close as won't fix. -- assignee: - mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16483 ___ ___ 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: This change is specifically aimed at code objects. As it is, it is impossible to produce code objects that share common data (e.g. filename strings, common tuples, name strings, etc) that don't unserialize to separate objects. Also, separately but related (see second patch) the effort spent in interning names when compiling, is lost when code objects are loaded back from disk. This change is based on work done at CCP to reduce the size of compiled code in memory. Simple preprocessing of code objects prior to writing them to disk can result in important memory savings. -- ___ 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
[issue16483] Make int(float('inf')) raise ValueError rather than OverflowError.
Serhiy Storchaka added the comment: There's also the minor practical inconvenience of having to remember to catch OverflowError *and* ValueError in try: .. except: constructs. And MemoryError (for big decimals). Might be the best solution would be raising an exception which subclasses both ValueError and OverflowError. Or make OverflowError to be subclass of ValueError. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16483 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15767] add ModuleNotFoundError
Ezio Melotti added the comment: I prefer ModuleNotFound. Its meaning is already clear enough, even without the Error suffix. OTOH we now have FileNotFoundError, but all the other OSError subclasses have that suffix. In general I think the suffix is necessary when it's not already clear from the name that we are dealing with an exception, otherwise it can be dropped. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15767 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16296] Patch to fix building on Win32/64 under VS 2010
Changes by Christoph Gohlke cgoh...@uci.edu: -- nosy: +cgohlke ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16296 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16484] Missing/broken documentation redirect for http://docs.python.org/library/xml.etree.ElementTree
New submission from Marius Gedminas: Do this: pydoc2.7 xml.etree.ElementTree then click on the MODULE DOCS link, which is http://docs.python.org/library/xml.etree.ElementTree You're redirected to http://docs.python.org/2/library/xml.etree.ElementTree which is a 404 page. -- assignee: docs@python components: Documentation messages: 175675 nosy: docs@python, mgedmin priority: normal severity: normal status: open title: Missing/broken documentation redirect for http://docs.python.org/library/xml.etree.ElementTree versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16484 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16478] Fix division in tabnanny
Ezio Melotti added the comment: The patch looks OK, buy can you provide a way to reproduce the error (if you get any)? Should we add tests for tabnanny? I tried to get an error from tabnanny but the only thing I got was a ResourceWarning (that can be easily fixed by a finally: f.close() near the end of the check() method). I also noticed that tabnanny doesn't detect any problem with: if 0: \t\t\t\t\t\t\tprint(1) else: print(2) if 1: print() else: \t \t print() -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16478 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16296] Patch to fix building on Win32/64 under VS 2010
Martin v. Löwis added the comment: Why did you put 3.2 into the version list? 3.2 doesn't use VS 2010. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16296 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16478] Fix division in tabnanny
Serhiy Storchaka added the comment: The patch looks OK, buy can you provide a way to reproduce the error (if you get any)? No, I have not any. I am even not sure tabnanny works at all. But this bug is obvious. So, let's fix it and go on. Should we add tests for tabnanny? This will be good, but it is a different issue. I'm not ready to write a test. I tried to get an error from tabnanny but the only thing I got was a ResourceWarning (that can be easily fixed by a finally: f.close() near the end of the check() method). I can't see a ResourceWarning. A finally: f.close() already exists near the end of the check() method. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16478 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16478] Fix division in tabnanny
Ezio Melotti added the comment: I can't see a ResourceWarning. A finally: f.close() already exists near the end of the check() method. Looks like it was added in 3.3. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16478 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16478] Fix division in tabnanny
Roundup Robot added the comment: New changeset fc17fdd42c66 by Ezio Melotti in branch '3.2': #16478: use floor division in tabnanny and fix a ResourceWarning. Patch by Serhiy Storchaka. http://hg.python.org/cpython/rev/fc17fdd42c66 New changeset d7558e4015a4 by Ezio Melotti in branch '3.3': #16478: merge with 3.2. http://hg.python.org/cpython/rev/d7558e4015a4 New changeset 377a50f8cb8b by Ezio Melotti in branch 'default': #16478: merge with 3.3. http://hg.python.org/cpython/rev/377a50f8cb8b -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16478 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16478] Fix division in tabnanny
Ezio Melotti added the comment: Applied the patch on all 3 branches and fixed the resource warning in 3.2. Thanks for the report and the patch! -- assignee: - ezio.melotti resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16478 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16481] process handle leak on windows in multiprocessing
Richard Oudkerk added the comment: Fixed in c574ce78cd61 and cb612c5f30cb. -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16481 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16485] FD leaks in aifc module
New submission from Serhiy Storchaka: Aifc_write.close() can raise exception and left the internal file object not closed. The patch closes the file object even in case of error and reset _file to None even in case of the file object close() raises an exception, so that Aifc_write.close() can be called repeatedly. -- components: Library (Lib) files: aifc_close.patch keywords: patch messages: 175683 nosy: serhiy.storchaka priority: normal severity: normal status: open title: FD leaks in aifc module type: resource usage versions: Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file27996/aifc_close.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16485] FD leaks in aifc module
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file27996/aifc_close.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16485] FD leaks in aifc module
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +r.david.murray Added file: http://bugs.python.org/file27997/aifc_close.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16485] FD leaks in aifc module
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file27998/aifc_close-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16485] FD leaks in aifc module
Ezio Melotti added the comment: Adding with support to Aifc_write looks like a new feature, but Aifc_write doesn't seem to be part of the public API. Does this change (indirectly) add with support to any part of the public API? -- nosy: +ezio.melotti stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16485] FD leaks in aifc module
Ezio Melotti added the comment: Adding with support to Aifc_write looks like a new feature, but Aifc_write doesn't seem to be part of the public API. Does this change (indirectly) add with support to any part of the public API? -- nosy: +ezio.melotti stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16485] FD leaks in aifc module
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file27998/aifc_close-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16485] FD leaks in aifc module
Serhiy Storchaka added the comment: Sorry, I miss that test_close() already exists. Merged. -- Added file: http://bugs.python.org/file27999/aifc_close.patch Added file: http://bugs.python.org/file28000/aifc_close-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___diff -r cb612c5f30cb Lib/aifc.py --- a/Lib/aifc.py Thu Nov 15 18:22:23 2012 + +++ b/Lib/aifc.py Fri Nov 16 15:22:51 2012 +0200 @@ -692,7 +692,9 @@ self._patchheader() def close(self): -if self._file: +if self._file is None: +return +try: self._ensure_header_written(0) if self._datawritten 1: # quick pad to even size @@ -700,13 +702,15 @@ self._datawritten = self._datawritten + 1 self._writemarkers() if self._nframeswritten != self._nframes or \ - self._datalength != self._datawritten or \ - self._marklength: +self._datalength != self._datawritten or \ +self._marklength: self._patchheader() +finally: # Prevent ref cycles self._convert = None -self._file.close() +f = self._file self._file = None +f.close() # # Internal methods. diff -r cb612c5f30cb Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py Thu Nov 15 18:22:23 2012 + +++ b/Lib/test/test_aifc.py Fri Nov 16 15:22:51 2012 +0200 @@ -112,6 +112,13 @@ self.assertEqual(testfile.closed, False) f.close() self.assertEqual(testfile.closed, True) +testfile = open(TESTFN, 'wb') +fout = aifc.open(testfile, 'wb') +self.assertFalse(testfile.closed) +with self.assertRaises(aifc.Error): +fout.close() +self.assertTrue(testfile.closed) +fout.close() # do nothing def test_write_header_comptype_sampwidth(self): for comptype in (b'ULAW', b'ulaw', b'ALAW', b'alaw', b'G722'): @@ -286,11 +293,13 @@ def test_write_header_raises(self): fout = aifc.open(io.BytesIO(), 'wb') self.assertRaises(aifc.Error, fout.close) +fout = aifc.open(io.BytesIO(), 'wb') fout.setnchannels(1) self.assertRaises(aifc.Error, fout.close) +fout = aifc.open(io.BytesIO(), 'wb') +fout.setnchannels(1) fout.setsampwidth(1) self.assertRaises(aifc.Error, fout.close) -fout.initfp(None) def test_write_header_comptype_raises(self): for comptype in (b'ULAW', b'ulaw', b'ALAW', b'alaw', b'G722'): diff -r 457c0c9c7893 Lib/aifc.py --- a/Lib/aifc.py Thu Nov 15 07:10:27 2012 +0100 +++ b/Lib/aifc.py Fri Nov 16 15:25:05 2012 +0200 @@ -732,22 +732,28 @@ self._patchheader() def close(self): -self._ensure_header_written(0) -if self._datawritten 1: -# quick pad to even size -self._file.write(chr(0)) -self._datawritten = self._datawritten + 1 -self._writemarkers() -if self._nframeswritten != self._nframes or \ - self._datalength != self._datawritten or \ - self._marklength: -self._patchheader() -if self._comp: -self._comp.CloseCompressor() -self._comp = None -# Prevent ref cycles -self._convert = None -self._file.close() +if self._file is None: +return +try: +self._ensure_header_written(0) +if self._datawritten 1: +# quick pad to even size +self._file.write(chr(0)) +self._datawritten = self._datawritten + 1 +self._writemarkers() +if self._nframeswritten != self._nframes or \ +self._datalength != self._datawritten or \ +self._marklength: +self._patchheader() +if self._comp: +self._comp.CloseCompressor() +self._comp = None +finally: +# Prevent ref cycles +self._convert = None +f = self._file +self._file = None +f.close() # # Internal methods. diff -r 457c0c9c7893 Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py Thu Nov 15 07:10:27 2012 +0100 +++ b/Lib/test/test_aifc.py Fri Nov 16 15:25:05 2012 +0200 @@ -106,6 +106,13 @@ self.assertEqual(testfile.closed, False) f.close() self.assertEqual(testfile.closed, True) +testfile = open(TESTFN, 'wb') +fout = aifc.open(testfile, 'wb') +self.assertFalse(testfile.closed) +with self.assertRaises(aifc.Error): +fout.close() +self.assertTrue(testfile.closed) +fout.close() # do nothing
[issue16485] FD leaks in aifc module
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file27997/aifc_close.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16486] Add context manager support to aifc module
New submission from Serhiy Storchaka: The proposed patch adds context manager support aifc module. Now objects returned by aifc.open() will support context manager protocol. This issue required first fixing issue16485 to pass tests. -- components: Library (Lib) files: aifc_context_manager.patch keywords: patch messages: 175687 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Add context manager support to aifc module type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file28001/aifc_context_manager.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16486 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16486] Add context manager support to aifc module
Changes by Serhiy Storchaka storch...@gmail.com: -- dependencies: +FD leaks in aifc module nosy: +r.david.murray stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16486 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16485] FD leaks in aifc module
Serhiy Storchaka added the comment: Adding with support to Aifc_write looks like a new feature, but Aifc_write doesn't seem to be part of the public API. Does this change (indirectly) add with support to any part of the public API? Don't pay attention, it was a wrong patch. For with support see issue16486. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16485 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11287] Add context manager support to dbm modules
Serhiy Storchaka added the comment: I added comments in Rietveld. -- nosy: +serhiy.storchaka stage: commit review - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11287 ___ ___ 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: This change is specifically aimed at code objects. As it is, it is impossible to produce code objects that share common data (e.g. filename strings, common tuples, name strings, etc) that don't unserialize to separate objects. Shouldn't strings be interned when the code object is unmarshalled? This change is based on work done at CCP to reduce the size of compiled code in memory. Simple preprocessing of code objects prior to writing them to disk can result in important memory savings. How important? -- ___ 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
[issue16487] Allow ssl certificates to be speficfied from memory rather than files.
New submission from Kristján Valur Jónsson: The _ssl module (and indeed the openssl lib) relies heaviliy on actual filesystem locations to load certificates. A client or a server may not want to rely on physical filesystem locations to load certificates for authentication or verification. Physical disc files are cumbersome and present a management burden in the presence of multiple processes. This patch adds extensions to the _ssl.c file which allows certificates, keys and certification chains to be provided by file contents, rather than file name. The ctx.load_cert_chain and ctx.load_verify_locations take additional arguments to specify the data on this form. the ssl.wrap_socket does not add arguments, rather the function is polymorphic in that the conents of the certfil/keyfile are examined and treated as file-data if beginning with -BEGIN. the ca_certs is similarly treated as a list of file contents, if it is a list, (rather than a string) This patch is the result of work at CCP for deploying ssl clients and servers in an isolated environment without having to resort to temporary disk files. -- components: Extension Modules files: sslpatch1.patch keywords: patch messages: 175691 nosy: kristjan.jonsson priority: normal severity: normal status: open title: Allow ssl certificates to be speficfied from memory rather than files. type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file28002/sslpatch1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16487 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16487] Allow ssl certificates to be speficfied from memory rather than files.
Kristján Valur Jónsson added the comment: (the patch contains a local change to set the location of the 'external' dir, please disregard this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16487 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16488] Add context manager support to epoll object
New submission from Serhiy Storchaka: The proposed patch adds support of context manager protocol to epoll objects. -- components: Extension Modules files: select_epoll_context_manager.patch keywords: patch messages: 175693 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Add context manager support to epoll object type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file28003/select_epoll_context_manager.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15346] Tkinter extention modules have no documentation
Changes by Daniel Swanson popcorn.tomato.d...@gmail.com: -- status: open - languishing ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15346 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11287] Add context manager support to dbm modules
Serhiy Storchaka added the comment: I think it will be better to call the close() method from the __exit__() method using _PyObject_CallMethodId(). It will allow to overload the close() method and get working context manager without overloading the __exit__() method. See issue16488 for example. -- versions: +Python 3.4 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11287 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15346] Tkinter extention modules have no documentation
Changes by Daniel Swanson popcorn.tomato.d...@gmail.com: -- status: languishing - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15346 ___ ___ 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: Basically, reuse of strings (and preservation of their internment status) fell by the wayside somewhere in the 3.x transition. Strings have been reused, and interned strings re-interned, since protocol version 1 in 2.x. This patch adds that feature back, and uses that mechanism to reuse not only strings, but also any other multiply-referenced object. It is not desirable to simply intern all strings that are read from marshaled data. Only selected strings are interned by python during compilation and we want to keep it that way. Also, 2.x reuses not only interned strings but other strings as well. Generalizing reuse of strings to other objects is trivial, and a logical step forward. This allows optimizations to be made on code objects where common data are identified and instanced, and those code objects to be saved and reloaded with that instancing intact. But even without such code-object optimization, the changes are significant: The sizes of the marshaled code object of lib/test/test_marshal drops from 24093 bytes in version 2 to 17841 bytes with version 3, without any additional massaging of the module code object. -- ___ 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
[issue15783] decimal.localcontext(None) fails when using the C accelerator module
Stefan Krah added the comment: OK, here's a patch. Specifics: o Except for the number methods, decimal.py and _decimal should behave identically now. o _decimal actually requires an additional context arg in same_quantum(), compare_total(), compare_total_mag() and copy_sign(). This is for raising InvalidOperation if the second operand is a very large integer and cannot be converted exactly. I've added the context arguments to the Python version to keep compatibility. o For some reason decimal.py uses a context arg in canonical(), so I've added it to the C version. o localcontext(ctx=None) is pretty ugly. Perhaps we should make the backwards incompatible switch to localcontext(context=None). I don't care a lot though. o I'd like to update the docstrings and the documentation in a separate patch. o The important idiom c.power(modulo=None, b=9, a=3) is now supported. :) -- Added file: http://bugs.python.org/file28004/issue15783-all.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15783 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16323] Wrong C API documentation for locale encoding
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16323 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
New submission from Xavier de Gaye: Create the following tree: foo.py mypackage __init__.py and get a loader for the non existent module 'mypackage.foo'. $ mkdir tmp $ cd tmp $ foo.py $ mkdir mypackage $ mypackage/__init__.py $ ./python Python 3.4.0a0 (default:53a7c2226a2b, Nov 9 2012, 16:47:41) [GCC 4.3.2] on linux Type help, copyright, credits or license for more information. import importlib importlib.find_loader('mypackage').get_filename() './mypackage/__init__.py' importlib.find_loader('mypackage.foo').get_filename() './foo.py' find_loader should return None in this case. -- components: Library (Lib) messages: 175697 nosy: xdegaye priority: normal severity: normal status: open title: importlib find_loader returns a loader for a non existent module type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
Xavier de Gaye added the comment: And yes, find_loader returns None, when correctly invoked with the path argument: importlib.find_loader('mypackage.foo', ['./mypackage/']) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15767] add ModuleNotFoundError
Chris Jerdonek added the comment: To state more explicitly the observation I alluded to in my comment above, we currently follow (without exception -- pun intended :) ) the convention that subclasses of exceptions that end in Error also end in Error. We also do the same with the suffix Warning. The latter is another reason to include the suffix Error -- to eliminate ambiguity as to whether the exception type inherits from a Warning class (e.g. from ImportWarning). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15767 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
R. David Murray added the comment: Not necessarily. The fact that there is nothing to load doesn't mean it isn't the right loader if there *was* something to load. But I'll leave it to the import experts to say what the expected behavior is. I'll admit that I can't figure it out from a quick perusal of the docs and PEP, so I'd say that regardless of what the correct behavior is there is at least a doc bug here. -- nosy: +brett.cannon, eric.smith, r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16487] Allow ssl certificates to be speficfied from memory rather than files.
Antoine Pitrou added the comment: (the patch contains a local change to set the location of the 'external' dir, please disregard this. Can you upload a cleaned up patch then? :) -- components: +Library (Lib) -Extension Modules nosy: +pitrou stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16487 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16488] Add context manager support to epoll object
Antoine Pitrou added the comment: I don't think that's very useful since generally the epoll object will have to survive accross function calls (it's usually stored as an attribute somewhere on your event loop). On the other hand, this addition doesn't hurt. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15767] add ModuleNotFoundError
Ezio Melotti added the comment: That seems indeed to be the case with built-in exceptions. I'm not sure if it's intentional or just a coincidence. I agree that warnings should always have a Warning suffix to distinguish them from exceptions, but in the stdlib the Error suffix is not used consistently. There are exceptions like: FloatOperation, DivisionByZero, InvalidOperation, TimeoutExpired, BrokenProcessPool, BufferTooShort, ImproperConnectionState, UnknownProtocol, InvalidURL, etc.. Anyway I don't have a strong opinion about this, so if you think the name should be ModuleNotFoundError it's OK with me (i.e. I'm -0). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15767 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
Brett Cannon added the comment: Everything is working as expected; you left out the path argument:: importlib.find_loader('package.foo', ['package']) This works the way it does because otherwise we would have to stat every single time from the top level on down and that is extremely costly. -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15031] Split .pyc parsing from module loading
Brett Cannon added the comment: In order to have exceptions that have messages like bad magic number in module there would need to be a technically unneeded fullname parameter. People cool with that? I personally dislike having info passed in just for error reporting, but in this case import exceptions typically try to clarify what actually caused the issue by naming the module since you can end up with deep implicit module chains. The other stuff related to bytecode paths are just for verbose logging or for setting path on ImportError, both of which can be worked around. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15031 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16484] Missing/broken documentation redirect for http://docs.python.org/library/xml.etree.ElementTree
Georg Brandl added the comment: The redirect is not the problem. The page never existed. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16484 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
Xavier de Gaye added the comment: Maybe find_loader could check its parameters, notice that the name is a dotted name, that path is None and in this case, not return a loader ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
Brett Cannon added the comment: That won't work as frozen and builtin modules don't care about the path. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16487] Allow ssl certificates to be speficfied from memory rather than files.
Kristján Valur Jónsson added the comment: Can't right now. It's only relevant for pcbuild anyway so you can test it for Unix if you want without fear. Don't worry, I always give my patches a cleanup before committing them. Meanwhile, I'd welcome comments on the substance. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16487 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
Xavier de Gaye added the comment: Not necessarily. The fact that there is nothing to load doesn't mean it isn't the right loader if there *was* something to load. But it is not even the right loader if there *was* something to load, as get_filename() returns './foo.py' which is wrong even if mypackage/foo.py had existed. It should have returned './mypackage/foo.py' to be an acceptable loader for a would-be mypackage.foo module. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15031] Split .pyc parsing from module loading
Eric Snow added the comment: Don't underestimate the potential value of having the fullname when overriding the method in a subclass. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15031 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16461] wave module: wrong integer format
Terry J. Reedy added the comment: The Wikipedia sentence The WAV format is limited to files that are less than 4 GB, because of its use of a 32-bit unsigned integer to record the file size header is unambiguous and appears correct (see below). The rest of the Wikipedia sentence (some programs limit the file size to 2 GB) must be because some programs mistakenly read into signed instead of unsigned ints and fail to later adjust (by, for instance, later casting to unsigned). The statement reflects the original specification given in reference 3, a .pdf. On page 11, it has ''' The basic building block of a RIFF file is called a chunk. Using C syntax, a chunk can be defined as follows: typedef unsigned long DWORD; typedef DWORD CKSIZE; // 32-bit unsigned size value typedef struct { // Chunk structure CKID ckID; // Chunk type identifier CKSIZE ckSize; // Chunk size field (size of ckData) ''' and on page 19 WORD 16-bit unsigned quantity in Intel formatunsigned int INT and LONG are defined as 16 and 32 bit signed versions. The WAVE specification, start on p. 56, uses WORD and DWORD, not INT and LONG for chunk header fields. Certainly, the 2 bytes for samples/sec should be unsigned to allow the standard 44100 CD rate. http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html (reference 4) summarized the .wav chunk formats. I think it just takes it for granted that sizes and counts are unsigned. The patch given did not touch the write format in line 469(3.3.0): self._file.write(struct.pack('l4s4slhhllhh4s', The first 'l' is filled with 36 + self._datalength and I believe the whole thing should be 'L4s4sLHHLLHH4s'. The two struct.unpack formats on lines 264 and 266 should also be changed. A workaround is to write large numbers as signed negatives. struct.unpack('L', struct.pack('l', 30 -2**32)) (30,) struct.unpack('H', struct.pack('h', 44100 - 2**16))[0] 44100 It is possible that someone is using this to write CD-quality files. It is also possible that anyone who has tried just gave up. -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16484] Missing/broken documentation redirect for http://docs.python.org/library/xml.etree.ElementTree
Marius Gedminas added the comment: A working link is http://docs.python.org/2/library/xml.etree.elementtree.html or http://docs.python.org/2/library/xml.etree.elementtree (with no .html at the end). Looks like capitalization is causing a problem. Did these pydoc links ever work? Would it be possible to make them work? There's a limited number of standard library modules with names that contain capital letters. find /usr/lib/python2.7 -name dist-packages -prune -o -name '*[A-Z]*' | wc -l gives me 211 names, but this is an imprecise upper bound because it includes files like 'distutils/README' that aren't modules or packages. Can I do anything to help? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16484 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16477] tarfile fails to close file handles in case of exception
Terry J. Reedy added the comment: Would with source = self.extractfile(tarinfo): work? -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16477 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12848] pickle.py treats 32bit lengths as signed, but _pickle.c as unsigned
Serhiy Storchaka added the comment: Here is a patch for 3.x. It unify behavior of Python and C implementations and unify behavior on 32- and 64-bit platforms. For backward compatibility Pickler can pickle up to 2G data, but Unpickler can unpickle up to 4G on 64-bit. -- keywords: +patch stage: - patch review Added file: http://bugs.python.org/file28005/pickle_portable_size.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12848 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
Xavier de Gaye added the comment: If one would want to fix this, one way to do it could be to change the following two methods of the PathFinder class such that: find_module() does not set path to sys.path when its path argument is None, so as to keep this information for _get_loader() to process it later _get_loader() sets path to sys.path when its path argument is None and returns a None loader when a loader has been found by a finder and: - this finder is a FileFinder instance - the _get_loader() path argument is None - the module name is a dotted name -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16465] dict creation performance regression
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16465 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16471] upgrade to sphinx 1.1
STINNER Victor added the comment: According to the changelog, Sphinx 1.1 now supports Python 3. Cool! Doc/Makefile may be modified to use PYTHON = python3. -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
Brett Cannon added the comment: Feel free to submit a patch, but I'm personally not motivated enough to try to change this on my own. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16489] importlib find_loader returns a loader for a non existent module
Eric V. Smith added the comment: It might be more motivating if you (Xavier de Gaye) could let us know of a real-world problem caused by this behavior. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16461] wave module: wrong integer format
Roundup Robot added the comment: New changeset b8ece33ce27d by Jesus Cea in branch '2.7': Closes #16461: Wave library should be able to deal with 4GB wav files, and sample rate of 44100 Hz. http://hg.python.org/cpython/rev/b8ece33ce27d New changeset 542bf1c1f2e3 by Jesus Cea in branch '3.2': Closes #16461: Wave library should be able to deal with 4GB wav files, and sample rate of 44100 Hz. http://hg.python.org/cpython/rev/542bf1c1f2e3 New changeset f380d749f6bd by Jesus Cea in branch '3.3': MERGE: Closes #16461: Wave library should be able to deal with 4GB wav files, and sample rate of 44100 Hz. http://hg.python.org/cpython/rev/f380d749f6bd New changeset 269498958b97 by Jesus Cea in branch 'default': MERGE: Closes #16461: Wave library should be able to deal with 4GB wav files, and sample rate of 44100 Hz. http://hg.python.org/cpython/rev/269498958b97 -- nosy: +python-dev resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15031] Split .pyc parsing from module loading
Brett Cannon added the comment: Attached is a patch that introduces _LoaderBasics.parse_bytecode_file(). It takes in basically what _bytes_from_bytecode() did plus a keyword-only boolean flag for exception suppression as that's needed to ignore stale bytecode when source is available. I still need to write specific tests for the method, but test.test_importlib passes. -- components: +Library (Lib) -Interpreter Core Added file: http://bugs.python.org/file28006/parse_pyc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15031 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16461] wave module: wrong integer format
Jesús Cea Avión added the comment: Thanks to Christian for the report and to Terry for digging the spec. Patched. Thanks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16453] Inconsistent dead weakref equality
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16453 ___ ___ 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}
Ned Deily added the comment: What problem are you trying to solve here? pyvenv is working as documented. And, although pyvenv does not claim to be compatible with the third-party virtualenv package, as far as I know virtualenv does not create links for local/bin and friends either. -- nosy: +ned.deily, vinay.sajip ___ 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
[issue16490] inspect.getargspec() and inspect.getcallargs() don't work with builtins
New submission from Jesús Cea Avión: Yesterday I was attending a conference about a MOCK like library and the speaker told us about some inspect functionalities not working correctly with builtins. For instance: Python 3.3.0 (default, Oct 2 2012, 02:07:16) [GCC 4.4.3] on linux Type help, copyright, credits or license for more information. import inspect def f(a=None) : ... pass ... inspect.getcallargs(f) {'a': None} inspect.getargspec(f) ArgSpec(args=['a'], varargs=None, keywords=None, defaults=(None,)) inspect.getcallargs(list) Traceback (most recent call last): File stdin, line 1, in module File /usr/local/lib/python3.3/inspect.py, line 993, in getcallargs spec = getfullargspec(func) File /usr/local/lib/python3.3/inspect.py, line 850, in getfullargspec raise TypeError('{!r} is not a Python function'.format(func)) TypeError: class 'list' is not a Python function inspect.getargspec(list) Traceback (most recent call last): File stdin, line 1, in module File /usr/local/lib/python3.3/inspect.py, line 823, in getargspec getfullargspec(func) File /usr/local/lib/python3.3/inspect.py, line 850, in getfullargspec raise TypeError('{!r} is not a Python function'.format(func)) TypeError: class 'list' is not a Python function Can we annotate builtins to support this?. What about types defined in CModules? -- messages: 175725 nosy: jcea priority: normal severity: normal status: open title: inspect.getargspec() and inspect.getcallargs() don't work with builtins versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16490 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16490] inspect.getargspec() and inspect.getcallargs() don't work for builtins
Changes by Jesús Cea Avión j...@jcea.es: -- title: inspect.getargspec() and inspect.getcallargs() don't work with builtins - inspect.getargspec() and inspect.getcallargs() don't work for builtins ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16490 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16490] inspect.getargspec() and inspect.getcallargs() don't work for builtins
Changes by Jesús Cea Avión j...@jcea.es: -- type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16490 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16490] inspect.getargspec() and inspect.getcallargs() don't work for builtins
Jesús Cea Avión added the comment: I am fully aware that the interpreter doesn't know how a method/function written in C is going to parse the parameter list/keywords. And that even if we solve this (for instance, with annotations that create wrappers calling PyArg_Parse() automatically), every C extension out there would need to support it too. Just brainstorming. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16490 ___ ___ 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}
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ 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