[issue26528] NameError for built in function open when re-raising stored exception from yielded function

2019-04-24 Thread Davide Rizzo
Davide Rizzo added the comment: I've just stumbled on the same thing happening on some code that attempts to use logging on __del__. Comparing dir(__builtins__) normally and on shutdown, these are missing: ['copyright', 'credits', 'exit', 'help',

[issue36139] release GIL on mmap dealloc

2019-03-06 Thread Davide Rizzo
Davide Rizzo added the comment: BTW should this be backported to 3.7? -- ___ Python tracker <https://bugs.python.org/issue36139> ___ ___ Python-bugs-list mailin

[issue36139] release GIL on mmap dealloc

2019-03-06 Thread Davide Rizzo
Davide Rizzo added the comment: Thanks Victor. I think this fixes it https://github.com/python/cpython/pull/12199 -- ___ Python tracker <https://bugs.python.org/issue36

[issue36139] release GIL on mmap dealloc

2019-03-06 Thread Davide Rizzo
Change by Davide Rizzo : -- pull_requests: +12194 ___ Python tracker <https://bugs.python.org/issue36139> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36139] release GIL on mmap dealloc

2019-02-28 Thread Davide Rizzo
Davide Rizzo added the comment: munmap() of private maps is usually pretty fast but not negligible (2 ms for 1GB). Shared maps are much slower. For some reason, shared maps explicitly backed by POSIX shared memory stand in between but are still pretty slow. If someone cares about file

[issue36139] release GIL on mmap dealloc

2019-02-28 Thread Davide Rizzo
Davide Rizzo added the comment: Yes, this is mmap module. I found this to be slow for posix-shm-backed mmaps. Several milliseconds, like 20ms for a 128 MB object. Maybe the same can happen with private|anon mmaps? I will follow up with more numbers

[issue36139] release GIL on mmap dealloc

2019-02-27 Thread Davide Rizzo
New submission from Davide Rizzo : munmap() can take a long time. I think mmap_object_dealloc can trivially release the GIL around this operation. Something similar was already mentioned in https://bugs.python.org/issue1572968 but a general patch was never provided. The dealloc case alone is

[issue31861] aiter() and anext() built-in functions

2017-10-27 Thread Davide Rizzo
Davide Rizzo added the comment: I attempted to make a Python implementation (attached) to use in my code. There are a few questions in the comments. One of the complications is the async equivalent of next with two arguments like next(iterator, default). It cannot return the result of

[issue31861] aiter() and anext() built-in functions

2017-10-24 Thread Davide Rizzo
Change by Davide Rizzo : -- nosy: +gvanrossum, yselivanov ___ Python tracker <https://bugs.python.org/issue31861> ___ ___ Python-bugs-list mailing list Unsub

[issue31861] aiter() and anext() built-in functions

2017-10-24 Thread Davide Rizzo
New submission from Davide Rizzo : PEP 525 suggested that adding aiter() and anext() would need to wait until async __aiter__ is dropped in 3.7. Issue 31709 solved that, so now it would be possible to add them. -- components: Library (Lib) messages: 304910 nosy: davide.rizzo priority

[issue19717] resolve() fails when the path doesn't exist

2016-05-08 Thread Davide Rizzo
Changes by Davide Rizzo : -- nosy: +davide.rizzo ___ Python tracker <http://bugs.python.org/issue19717> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26976] pathlib equivalent for os.path.realpath()

2016-05-08 Thread Davide Rizzo
Changes by Davide Rizzo : -- type: -> enhancement ___ Python tracker <http://bugs.python.org/issue26976> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue26976] pathlib equivalent for os.path.realpath()

2016-05-08 Thread Davide Rizzo
New submission from Davide Rizzo: pathlib doesn't provide an exact replacement for os.path.realpath(). Path.resolve() is the closest equivalent, but differs in behavior in one case: when the path does not exist. >>> os.path.realpath('/foo') '/foo' >>

[issue24632] Improve documentation about __main__.py

2015-07-16 Thread Davide Rizzo
Davide Rizzo added the comment: As far as I understand, assuming dir/ contains a __main__.py file $ python dir is equivalent to $ python dir/__main__.py in that it's behaviourally nothing more than executing a script in that dir and setting sys.path accordingly. This is the same in Pyt

[issue15360] Behavior of assigning to __dict__ is not documented

2012-07-20 Thread Davide Rizzo
Davide Rizzo added the comment: Amaury, I don't honestly know, I would have proposed something otherwise. I have been advised on #python (Freenode) not to assign to obj.__dict__ because its behaviour changes between versions and implementations, but I wouldn't know what has chang

[issue15360] Behavior of assigning to __dict__ is not documented

2012-07-15 Thread Davide Rizzo
New submission from Davide Rizzo : The documentation (at least the obvious places, see Doc/reference/datamodel.rst) says classes and class instances have the '__dict__' attribute, but nothing is said about what happens when assigning to it (like obj.__dict__ = something). A

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2012-06-30 Thread Davide Rizzo
Davide Rizzo added the comment: Daniel, Nick, shouldn't the context manager yield f within a with block? -- nosy: +davide.rizzo ___ Python tracker <http://bugs.python.org/is

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Davide Rizzo
Davide Rizzo added the comment: As much as I hate being wrong, I must concur with you. ;) Thank you, Mark. -- ___ Python tracker <http://bugs.python.org/issue12

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Davide Rizzo
Davide Rizzo added the comment: Mark, it's been a long time since I went through this bug and don't remember the details. Are you sure subtype_dealloc should not call PyType_Modified? It looked like the appropriate place at the time. In the example the reference cycle was int

[issue13359] urllib2 doesn't escape spaces in http requests

2011-11-06 Thread Davide Rizzo
New submission from Davide Rizzo : urllib2.urlopen('http://foo/url and spaces') will send a HTTP request line like this to the server: GET /url and spaces HTTP/1.1 which the server obviously does not understand. This contrasts with urllib's behaviour which replaces the spac

[issue12576] urlib.request fails to open some sites

2011-07-18 Thread Davide Rizzo
Changes by Davide Rizzo : -- nosy: +davide.rizzo ___ Python tracker <http://bugs.python.org/issue12576> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue12549] test_platform test_mac_ver fails on Darwin x86_64

2011-07-13 Thread Davide Rizzo
Davide Rizzo added the comment: I first saw it failing on 3.3 while testing for another bug, then run the test on other versions including 2.7 and it always fails. System Python 2.6 does NOT fail, but it has no _mac_ver_xml(). This is a MacBook Pro 13" with Intel Co

[issue12549] test_platform test_mac_ver fails on Darwin x86_64

2011-07-13 Thread Davide Rizzo
Davide Rizzo added the comment: No, it's 10.6.8. Now that I think of it I updated from 10.6.7 recently. But I have no 10.6.7 x86_64 bit machine where to test. -- ___ Python tracker <http://bugs.python.org/is

[issue12549] test_platform test_mac_ver fails on Darwin x86_64

2011-07-13 Thread Davide Rizzo
New submission from Davide Rizzo : test test_platform failed -- Traceback (most recent call last): File "/Users/davide/cpython/Lib/test/test_platform.py", line 194, in test_mac_ver self.assertEqual(res[2], 'i386') AssertionError: 'x86_64' != 'i386'

[issue12546] str.format cannot fill with \x00 char

2011-07-13 Thread Davide Rizzo
Davide Rizzo added the comment: Here's the patch. Same rationale as above (removed the special meaning of '\x00', default specified in parse_internal_render_format_spec). Sorry about the mess again! -- Added file: http://bugs.python.org/file22640

[issue12546] str.format cannot fill with \x00 char

2011-07-13 Thread Davide Rizzo
Changes by Davide Rizzo : Removed file: http://bugs.python.org/file22639/format00.patch ___ Python tracker <http://bugs.python.org/issue12546> ___ ___ Python-bugs-list m

[issue12546] str.format cannot fill with \x00 char

2011-07-13 Thread Davide Rizzo
Davide Rizzo added the comment: Oops, sorry. Above patch was overly buggy. Please just ignore it. -- ___ Python tracker <http://bugs.python.org/issue12

[issue12546] str.format cannot fill with \x00 char

2011-07-13 Thread Davide Rizzo
Davide Rizzo added the comment: This patch removes the special meaning for \x00 and defines the default padding character (' ') in parse_internal_render_format_spec. Test included. Maybe the default padding character should be defined elsewhere? -- keywords: +

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-12 Thread Davide Rizzo
Davide Rizzo added the comment: The attached test segfaults (and passes with the patch). It wasn't clear to me where to put the test (it is a typeobject issue triggered by io) but Antoine on IRC agreed it would make sense to add it to test_io anyway. Python 2.7 is affected too by th

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-05 Thread Davide Rizzo
Davide Rizzo added the comment: Invalidating the cache in subtype_clear prevents the "close" method to be called in the collected object. I'm not sure that's the right place where to put the PyType_Modified, but apparently it works. -- Added file: http://bugs.

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-05 Thread Davide Rizzo
Davide Rizzo added the comment: Looking through Antoine's example code. When garbage is collected, the subtype and its tp_dict are cleared before the instance object itself. When the dict is cleared as part of the garbage collection, the methods get deallocated but the method cache i

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-05-22 Thread Davide Rizzo
Changes by Davide Rizzo : -- nosy: +davide.rizzo ___ Python tracker <http://bugs.python.org/issue12149> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue12077] Harmonizing descriptor protocol documentation

2011-05-14 Thread Davide Rizzo
New submission from Davide Rizzo : There are three sources of information for the descriptor protocol: - Data model reference (Doc/reference/datamodel.rst) - Descriptor HowTo guide (Doc/howto/descriptor.rst) - PEP 252 A developer who already knows descriptor tipically reads the first one

[issue11650] Faulty RESTART/EINTR handling in Parser/myreadline.c

2011-04-09 Thread Davide Rizzo
Davide Rizzo added the comment: Victor, I have neither OS X nor Linux available right now, but if I remember correctly the same happens on both systems when programs call input() (but not from the REPL). See also my previous message with "python -c" tests and my second remark.

[issue11713] collections.deque docstring wrong/misleading

2011-03-29 Thread Davide Rizzo
New submission from Davide Rizzo : collections.deque docstring is: 'deque(iterable[, maxlen]) --> deque object\n\nBuild an ordered collection accessible from endpoints only.' As it reads now, it seems to imply that only endpoints can be read/modified. The rst correctly state

[issue11650] Faulty RESTART/EINTR handling in Parser/myreadline.c

2011-03-29 Thread Davide Rizzo
Davide Rizzo added the comment: An effective way to automate user interaction tests is by using pseudo-terminals. The attached test uses Pexpect and bash as tools to test the issue and demonstrates the bug on affected builds/platforms. There are a number of (possibly related) other issues

[issue11650] Faulty RESTART/EINTR handling in Parser/myreadline.c

2011-03-25 Thread Davide Rizzo
Davide Rizzo added the comment: The bugs seems not to be limited to the REPL. # Python 2.6 with readline on Mac OS X $ python -c "raw_input()" ^Z [1]+ Stopped python -c "raw_input()" $ fg python -c "raw_input()" Traceback (most recent cal

[issue11650] Faulty RESTART/EINTR handling in Parser/myreadline.c

2011-03-24 Thread Davide Rizzo
Changes by Davide Rizzo : -- nosy: +mwh ___ Python tracker <http://bugs.python.org/issue11650> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue11650] Faulty RESTART/EINTR handling in Parser/myreadline.c

2011-03-23 Thread Davide Rizzo
Davide Rizzo added the comment: I couldn't get an automated test to fail on the bug with subprocess. Apparently an interpreter launched with Popen is not subject to the bug as it is when launched directly from the shell (i.e. fgets is not interrupted by a SIGSTOP sent by the parent pr

[issue11650] Faulty RESTART/EINTR handling in Parser/myreadline.c

2011-03-23 Thread Davide Rizzo
Davide Rizzo added the comment: The faulty behavior was presumably introduced in r36346, when the continue statement was removed. I already linked the relevant discussion, but I'm not sure whether that was a desired change or just an oversight. I'm inclined to believe the lat

[issue11650] CTRL-Z causes interpreter exit

2011-03-23 Thread Davide Rizzo
Davide Rizzo added the comment: The patch works fine, thank you. I was trying the same fix, but got stuck trying to understand what led to the decision in issue 960406. Still not sure. -- ___ Python tracker <http://bugs.python.org/issue11

[issue11650] CTRL-Z causes interpreter exit

2011-03-23 Thread Davide Rizzo
Davide Rizzo added the comment: You are right. The previous runs were without readline. With readline it behaves as expected. For the sake of completeness, here's the output of your snippet after Ctrl+Z, fg: getchar: Interrupted system

[issue11650] CTRL-Z causes interpreter exit

2011-03-23 Thread Davide Rizzo
Davide Rizzo added the comment: The process did exit on fg. Compare with the 2nd paste on my previous message (Python shipped with OS X). -- ___ Python tracker <http://bugs.python.org/issue11

[issue11650] CTRL-Z causes interpreter exit

2011-03-23 Thread Davide Rizzo
Davide Rizzo added the comment: davide@macrisorto ~/cpython $ ./python.exe Python 3.3a0 (default:4a5782a2b074, Mar 23 2011, 15:26:35) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" fo

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2011-03-08 Thread Davide Rizzo
Changes by Davide Rizzo : -- nosy: +davide.rizzo ___ Python tracker <http://bugs.python.org/issue2636> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue10622] WebKit browsers show superfluous scrollbars in html docs

2010-12-04 Thread Davide Rizzo
New submission from Davide Rizzo : Some WebKit browsers show a superflous scrollbar on the right side of the boxes in the Sphinx generated html docs. For example: http://666kb.com/i/boxys2zktxky17vsh.png taken on Chrome 7 on Windows. I believe that the cause of the behaviour is a bug in the

[issue3243] Support iterable bodies in httplib

2010-11-30 Thread Davide Rizzo
Davide Rizzo added the comment: > len(data) will raise anyway. No, it won't, if the iterable happens to be a sequence. -- nosy: +davide.rizzo ___ Python tracker <http://bugs.python.or

[issue10535] Enable warnings by default in unittest

2010-11-26 Thread Davide Rizzo
Changes by Davide Rizzo : -- nosy: +davide.rizzo ___ Python tracker <http://bugs.python.org/issue10535> ___ ___ Python-bugs-list mailing list Unsubscribe: