[issue22568] Use of utime as variable name in Modules/posixmodule.c causes errors
Georg Brandl added the comment: Patch LGTM. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22568 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18119] urllib.FancyURLopener does not treat URL fragments correctly
karl added the comment: OK I fixed the code. The issue is here https://hg.python.org/cpython/file/1e1c6e306eb4/Lib/urllib/request.py#l656 newurl = urlunparse(urlparts) Basically it reinjects the fragment in the new url. The fix is easy. if urlparts.fragment: urlparts = list(urlparts) urlparts[5] = newurl = urlunparse(urlparts) I was trying to make a test for it, but failed. Could someone help me for the test so I can complete the patch? Added the code patch only. -- keywords: +patch Added file: http://bugs.python.org/file36832/issue18119-code-only.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18119 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12458] Tracebacks should contain the first line of continuation lines
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- stage: test needed - needs patch versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12458 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22571] Remove import * recommendations and examples in doc?
Mark Dickinson added the comment: I think it's fine to recommend using (for example) ` from decimal import *` at the command-line prompt when experimenting with a module. It's a quick way to get yourself into a state where you can easily experiment with that module and its features. That's not the same as recommending that scripts using the decimal module start with from decimal import *, of course. -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22571 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22294] 2to3 consuming_calls: len, min, max, zip, map, reduce, filter, dict, xrange
Changes by Edward O edoubray...@gmail.com: -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22294 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22574] super() and del in the same method leads to UnboundLocalError
New submission from Pierre-Antoine BRAMERET: Hi, With the following code: class Base(object): pass class Foo(Base): def __init__(self): super(Foo,self).__init__() if False: del Foo I expect that Foo() would give me a Foo instance. Instead, it raises the following exception: Traceback (most recent call last): File stdin, line 1, in module File stdin, line 3, in __init__ super(Foo,self).__init__() UnboundLocalError: local variable 'Foo' referenced before assignment I first suspected the del Foo statement is executed before the function is executed (while parsing or something), because the error tells Foo does not exists. Howver, the problem is deeper than that: with the following modified code: class Foo(Base): def __init__(self): assert 'Foo' in globals() assert Foo super(Foo,self).__init__() if False: del Foo Traceback (most recent call last): File stdin, line 1, in module File stdin, line 4, in __init__ super(Foo,self).__init__() UnboundLocalError: local variable 'Foo' referenced before assignment So: Foo IS in globals(), but cannot be accessed through Foo in the class because of the presence of 'del Foo' in the never reached part of the method. -- messages: 228757 nosy: Miaou priority: normal severity: normal status: open title: super() and del in the same method leads to UnboundLocalError versions: Python 2.7, Python 3.2, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22574 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22572] NoneType object is not iterable error when asyncio Server.close() called
STINNER Victor added the comment: Using call_soon_threadsafe from an addCleanup in the _server method makes it work for me. Maybe the documentation on thread safety should be improved? More warnings should be put in the documentation? https://docs.python.org/dev/library/asyncio-dev.html#concurrency-and-multithreading -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22572 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22574] super() and del in the same method leads to UnboundLocalError
Pierre-Antoine BRAMERET added the comment: Sorry, I miscopied the last Traceback. Please find the following: Traceback (most recent call last): File stdin, line 1, in module File stdin, line 4, in __init__ assert Foo UnboundLocalError: local variable 'Foo' referenced before assignment -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22574 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22572] NoneType object is not iterable error when asyncio Server.close() called
STINNER Victor added the comment: Maybe we should more checks in debug mode in the Server class? For example, loop.call_soon() raises an AssertionError if it is called from the wrong thread in debug mode. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22572 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18216] gettext doesn't check MO versions
Jakub Wilk added the comment: The patch hardcodes 5 as version number in the exception message. The specifiction also says that an unexpected minor revision number means that the file can be read but will not reveal its full contents, when parsed by a program that supports only smaller minor revision numbers. So I think a reasonable thing to do is to accept MO files with an expected major revision but an unexpected minor revision. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18216 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22572] NoneType object is not iterable error when asyncio Server.close() called
STINNER Victor added the comment: Oh, I didn't notice that waiter_bug.py does nothing :-) I added unittest.main(). With PYTHONASYNCIODEBUG=1, I get *two* errors, maybe we don't need to add more checks in debug mode. Again, maybe the debug mode should be better documented? https://docs.python.org/dev/library/asyncio-dev.html#debug-mode-of-asyncio Currently, it's at the end of the documentation. ERROR:asyncio:CoroWrapper Server.wait_closed() running at /home/haypo/prog/python/default/Lib/asyncio/base_events.py:143, created at waiter_bug.py:32 was never yielded from Coroutine object created at (most recent call last): File waiter_bug.py, line 43, in module unittest.main() File /home/haypo/prog/python/default/Lib/unittest/main.py, line 93, in __init__ self.runTests() File /home/haypo/prog/python/default/Lib/unittest/main.py, line 244, in runTests self.result = testRunner.run(self.test) File /home/haypo/prog/python/default/Lib/unittest/runner.py, line 168, in run test(result) File /home/haypo/prog/python/default/Lib/unittest/suite.py, line 87, in __call__ return self.run(*args, **kwds) File /home/haypo/prog/python/default/Lib/unittest/suite.py, line 125, in run test(result) File /home/haypo/prog/python/default/Lib/unittest/suite.py, line 87, in __call__ return self.run(*args, **kwds) File /home/haypo/prog/python/default/Lib/unittest/suite.py, line 125, in run test(result) File /home/haypo/prog/python/default/Lib/unittest/case.py, line 625, in __call__ return self.run(*args, **kwds) File /home/haypo/prog/python/default/Lib/unittest/case.py, line 582, in run self.doCleanups() File /home/haypo/prog/python/default/Lib/unittest/case.py, line 618, in doCleanups function(*args, **kwargs) File waiter_bug.py, line 32, in _stop_server self.server.wait_closed() DEBUG:asyncio:Using selector: EpollSelector E == ERROR: test_version (__main__.Test) -- Traceback (most recent call last): File waiter_bug.py, line 33, in _stop_server self.server_loop.stop() File /home/haypo/prog/python/default/Lib/asyncio/base_events.py, line 285, in stop self.call_soon(_raise_stop_error) File /home/haypo/prog/python/default/Lib/asyncio/base_events.py, line 373, in call_soon handle = self._call_soon(callback, args, check_loop=True) File /home/haypo/prog/python/default/Lib/asyncio/base_events.py, line 382, in _call_soon self._assert_is_current_event_loop() File /home/haypo/prog/python/default/Lib/asyncio/base_events.py, line 404, in _assert_is_current_event_loop Non-thread-safe operation invoked on an event loop other RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22572 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22564] ssl: post-commit review of the new memory BIO API
STINNER Victor added the comment: For total cleanness maybe the constructor should raise a TypeError if server_hostname is passes as a bytes. Oh. So there are two attributes? SSLSocket.server_hostname and SSLSocket._sslobj.server_hostname? The constructor should make sure that both are consistent (ex: initialize SSLSocket.server_hostname from sslobj.server_hostname), or SSLSocket.server_hostname should be a property reading SSLSocket._sslobj.server_hostname (or a getter/setter if we should be able to modify it). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22564 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22574] super() and del in the same method leads to UnboundLocalError
Mark Dickinson added the comment: So while the behaviour is surprising, the language is behaving as designed: the target of `del` is considered to be a local variable for the entire function definition. (In much the same way, the targets of simple assignments are considered local, so if you'd assigned to Foo in the if False: block, you'd see the same error.) The behaviour is documented here: https://docs.python.org/3.4/reference/executionmodel.html#naming-and-binding Note particularly these bits: If a name is bound in a block, it is a local variable of that block, [...] A target occurring in a del statement is also considered bound for this purpose [...] See also this FAQ: https://docs.python.org/3/faq/programming.html#id8 I wonder whether it's worth updating the FAQ to mention that `del` is considered to bind names in this way. -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22574 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22568] Use of utime as variable name in Modules/posixmodule.c causes errors
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22568 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7830] Flatten nested functools.partial
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo type: enhancement - performance ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7830 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22572] NoneType object is not iterable error when asyncio Server.close() called
R. David Murray added the comment: Yes, documenting it at the beginning would be good. I haven't gotten to the end of the docs yet, I like to experiment as I go along :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22572 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22574] super() and del in the same method leads to UnboundLocalError
Pierre-Antoine BRAMERET added the comment: Hi, Tanks for your clear answer. I find it surprising that del bounds the name locally, but with little more thinking, it is not... -- resolution: - not a bug status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22574 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18161] call fchdir if subprocess.Popen(cwd=integer|fileobject)
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18161 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22570] Better stdlib support for Path objects
Brett Cannon added the comment: I think I'm missing something here because the idea of doing `path = str(path)` at the API boundary for an old function to support both Path and str objects for paths seems fairly minimal. Only when manipulating a path is wanting a Path object going to come up, and in that case can't you just do `path = pathlib.Path(path)` instead? -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22570 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22570] Better stdlib support for Path objects
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22570 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18216] gettext doesn't check MO versions
Aaron Hill added the comment: That sounds good. Should a warning be thrown for an unexpected minor revision? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18216 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12067] Doc: remove errors about mixed-type comparisons.
Andy Maier added the comment: Just wanted to say that i will continue working on this, working in the comments made so far... Andy -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22297] 2.7 json encoding broken for enums
Edward O added the comment: The arguments for fixing: * int subclasses overriding str is a very common usecase for enums (so much so that it was added to stdlib in 3.4). * json supporting a standard type of a subsequent python version, though not mandatory, would be beneficial to Py2/Py3 compatibility. * fixing this cannot break existing code * the fix could theoretically be done to 3.0-3.3 if Ethan's argument is deemed important. -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22297 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22575] bytearray documentation confuses string for unicode objects
New submission from Martijn Pieters: The Python 2 version of the bytearray() documentation appears to be copied directly from its Python 3 counterpart and states that when passing in a string an encoding is required: * If it is a string, you must also give the encoding (and optionally, errors) parameters; bytearray() then converts the string to bytes using str.encode(). (from https://docs.python.org/2/library/functions.html#bytearray). This obviously doesn't apply to Python 2 str() objects, but would only apply to unicode() objects. Can this be corrected? The current wording is confusing new users (see http://stackoverflow.com/questions/26230745/how-to-convert-python-str-to-bytearray). -- assignee: docs@python components: Documentation messages: 228771 nosy: docs@python, mjpieters priority: normal severity: normal status: open title: bytearray documentation confuses string for unicode objects versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22575 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22534] bsddb memory leak with MacPorts bdb 4.6
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22534 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22477] GCD in Fractions
Stefan Behnel added the comment: it might be worth at least considering how a 'one or more parameter' gcd compares on performance grounds with a two parameter one. There shouldn't be a difference in practice. The bulk of the work is in the algorithm that finds the GCD of two numbers, and finding the GCD of multiple numbers is simply functools.reduce(math.gcd, seq_of_numbers) Since the most common use case is finding the GCD of two numbers, I don't see a reason to burden the implementation with a special case here. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22477 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22576] ftplib documentation gives a wrong argument name for storbinary
New submission from Derek Kurth: The Python 3 documentation for ftplib gives the storbinary method signature as: FTP.storbinary(cmd, file, blocksize=8192, callback=None, rest=None) However, the parameter named file is actually named fp in the code, so if you do something like this: ftp.storbinary(cmd=RETR something.txt, file=f) then you will get a TypeError: storbinary() got an unexpected keyword argument 'file'. I think the documentation should be updated to call that argument fp instead of file. -- assignee: docs@python components: Documentation messages: 228773 nosy: Derek.Kurth, docs@python priority: normal severity: normal status: open title: ftplib documentation gives a wrong argument name for storbinary versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22576 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22462] Modules/pyexpat.c violates PEP 384
Antoine Pitrou added the comment: Here is an updated patch with a test. -- Added file: http://bugs.python.org/file36833/expat_traceback.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22462 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22524] PEP 471 implementation: os.scandir() directory scanning function
STINNER Victor added the comment: Hi Ben, I started to review your patch, sorry for the delay :-( It's convinient to have the patch on Rietveld to comment it inline. I didn't expect so much C code. The posixmodule.c is really huge. Well, it's just the longest C file of Python 3.5. Your patch adds 781 more lines to it. It's maybe time to split the file into smaller files. At the same time, reading C code is boring and it's too easy to implement bugs. I need to be convinced that the speedup announced in the PEP requires so much C code. In the PEP and https://github.com/benhoyt/scandir#benchmarks it's not clear if the speedup comes from the C code (instead of implementing scandir in pure Python, for example using ctypes) or the lower number of syscalls. To have a fair benchmark, the best would be to have a C part only implementing opendir/readir and FirstFindFile/FindFileXXX (I'm not sure that ctypes is as fast as C code written with the Python C API), and a Python part which implements the nice Python API. If the speedup is 10% or lower, I would prefer to not add so much C code and take the compromise of a thin C wrapper and implement scandir in Python. If we implement os.scandir() in Python, should we still try to share code with os.listdir()? I see that importlib uses os.listdir(), so we need a listdir() function implemented in C at least for importlib. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22524 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16177] Typing left parenthesis in IDLE causes intermittent Cocoa Tk crash on OS X
Tom Goddard added the comment: I've seen this crash about 50 times in the UCSF Chimera molecular visualization package, same traceback, and it is caused when a tooltip is raised, but not from IDLE. The key observation is that it only happens on dual display systems where the second display is positioned partly or entirely above or to the left of the primary display. An attempt to raise a tooltip on that second display causes a crash. This seems almost certain to be a Mac Tk bug. At first I thought it was caused by the x,y screen position of the tool tip being negative. But when the second screen is arranged above the primary screen (in Mac display system preferences) the y position is which increases from bottom to top is something like 2000, not negative. Currently my hunch is that the tooltip popup window was created for the primary display, and trying to position it on the secondary display is for some reason an error. I don't know enough about the native Mac NSWindow to say anything definitive. Hope this helps you to at least consistently reproduce the crash. -- nosy: +goddard ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16177 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16177] Typing left parenthesis in IDLE causes intermittent Cocoa Tk crash on OS X
Tom Goddard added the comment: More testing shows that this Mac Tk crash with dual displays only happens when the second display is partly or entirely above the primary display in the Mac display system preferences. An attempt to show the tooltip on the second display above the top of the primary display a crash happens. Contrary to my previous comment it does not appear to depend on whether the secondary display is to the right or to the left of the primary display. Possibly the key factor is that the tooltip is being displayed above Mac top of (primary) screen menu bar. It is possible that that is an Apple bug, rather than a Mac Tk bug. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16177 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16177] Typing left parenthesis in IDLE causes intermittent Cocoa Tk crash on OS X
Ned Deily added the comment: Tom, thanks for the detailed analysis. It seems pretty clear that this is not a Python problem and there's really nothing we can do about it. It would be great if you would be willing to open an issue on the Tcl/Tk project's issue tracker so that they are aware of it and perhaps can investigate it now that there might be a way to reliably reproduce the crash. I'm going to close this issue under the assumption it is a Tk problem. If it should prove otherwise, feel free to re-open. http://core.tcl.tk/tcl/reportlist -- resolution: - third party stage: test needed - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16177 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com