[issue28080] Allow reading member names with bogus encodings in zipfile
Stephen J. Turnbull added the comment: I'm not going to have time to look at the PR for a couple days. I don't understand what the use case is for writing or appending with filenames in a non-UTF-8 encoding. At least in my experience, reading such files is rare, but I have never been asked to write one. The correspondents who send me zipfiles with the directory encoded in shift_jisx0213 are perfectly happy to read zipfiles with the directory encoded in UTF-8. If that is true for other users, then unzipping the file to a temporary directory with the appropriate --metadata-encoding, adding the required paths there, and zipping a new archive seems perfectly workable. In that case making this feature read-only makes the most sense to me. -- ___ Python tracker <https://bugs.python.org/issue28080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46734] Add Maildir.get_flags() to access message flags without opening the file
Change by Stephen Gildea : -- keywords: +patch pull_requests: +29463 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31302 ___ Python tracker <https://bugs.python.org/issue46734> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46734] Add Maildir.get_flags() to access message flags without opening the file
New submission from Stephen Gildea : A message's flags are stored in its filename by Maildir, so the flags are available without reading the message file itself. The structured message file name makes it efficient to scan a large mailbox to select only messages that are, for example, not Trashed. The mailbox.Maildir interface does not expose these flags, however. The only way to access the flags through the mailbox library is to create a mailbox.MaildirMessage object, which has a get_flags() method. But creating a MaildirMessage requires opening the message file, which is slow. I propose adding a parallel get_flags(key) method to mailbox.Maildir, so that the flags are available without having to create a MaildirMessage object. In iterating through a mailbox with thousands of messages, I find that this proposed Maildir.get_flags() method is 50 times faster than MaildirMessage.get_flags(). -- components: Library (Lib) messages: 413145 nosy: gildea priority: normal severity: normal status: open title: Add Maildir.get_flags() to access message flags without opening the file type: enhancement versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue46734> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45356] Calling `help` executes @classmethod @property decorated methods
Stephen Rosen added the comment: Probably >90% of the use-cases for chaining classmethod are a read-only class property. It's important enough that some tools (e.g. sphinx) even have special-cased support for classmethod(property(...)). Perhaps the general case of classmethod(descriptor(...)) should be treated separately from the common case? > I propose deprecating classmethod chaining. It has become clear that it > doesn't really do what people wanted and can't easily be made to work. If classmethod(property(f)) is going to be removed, can an implementation of classproperty be considered as a replacement? Or perhaps support via the other ordering, property(classmethod(f))? -- nosy: +sirosen2 ___ Python tracker <https://bugs.python.org/issue45356> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35228] Index search in CHM help crashes viewer
Change by Stephen Paul Chappell : -- nosy: +Zero ___ Python tracker <https://bugs.python.org/issue35228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception
Stephen Carboni added the comment: Just chiming in to say that this is still broken for me on Python 3.9.6, Win10/64: https://pastebin.com/64F2iKaj But, works for 3.10.0b4. -- nosy: +stephen.entropy ___ Python tracker <https://bugs.python.org/issue30256> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43972] Simple HTTP Request Handler in http.server does not set a content-length and does not close connections on 301s
Stephen Rosen added the comment: Thanks for working with me to reproduce and understand the issue. I'm a little surprised that with the sample which sets the protocol version you're still not seeing the issue. If I create a directory tree, e.g. repro ├── foo/ └── server.py where `server.py` is the sample I gave, and run `server.py`, I find that `curl localhost:8000/foo` hangs. `curl -v` includes a message as part of its output which states that it's waiting for the connection to close. Full verbose output: ``` $ curl localhost:8000/foo -v * Trying 127.0.0.1:8000... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8000 (#0) > GET /foo HTTP/1.1 > Host: localhost:8000 > User-Agent: curl/7.68.0 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 301 Moved Permanently < Server: SimpleHTTP/0.6 Python/3.8.5 < Date: Thu, 06 May 2021 15:53:13 GMT < Location: /foo/ * no chunk, no close, no size. Assume close to signal end < ^C ``` This holds over a few python versions: 3.6.12, 3.8.5, and 3.9.1 . That's probably a good enough sample since the relevant code hasn't changed in the stdlib. It's doubtful that the exact version of curl matters for this. I can also see the issue with Firefox opening `localhost:8000/foo`. It hangs without processing the redirect. Running the sample I gave, you're seeing curl exit cleanly? I wonder, with verbose output, maybe there's some useful message that will tell us why it's exiting. Does it not print the message, "no chunk, no close, no size. Assume close to signal end" ? > Note: the existing behavior is 10+ year old and don't want to introduce > changes if it is not a bug. I completely understand this stance. I believe it is a bug, but that it's rare enough that hasn't been filed or resolved, in spite of its age. Some browsers (e.g. Chrome) process redirects without waiting for a payload, so they would mask the issue. Plus, it only shows up when the protocol_version is set. I had a script at work with this issue for over a year without anyone running into the hangs. A coworker who prefers Firefox noticed the issue only recently, and I traced that back to this behavior. So even in my case, I didn't stumble across this issue until we'd been using the same test script with the bug in it for a long time. -- ___ Python tracker <https://bugs.python.org/issue43972> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43972] Simple HTTP Request Handler in http.server does not set a content-length and does not close connections on 301s
Stephen Rosen added the comment: Ach! Sorry! I didn't even realize this but the issue only arises when you are modifying the handler to set the protocol to HTTP/1.1 . In HTTP/1.0 , there's no notion of persistent connections, so the issue does not arise. But when the protocol version changes to 1.1 , persistent connections are the norm, and curl will wait indefinitely. The following short script is sufficient to reproduce: ``` import http.server class CustomRequestHandler(http.server.SimpleHTTPRequestHandler): protocol_version = "HTTP/1.1" with http.server.HTTPServer(("", 8000), CustomRequestHandler) as httpd: try: httpd.serve_forever() except KeyboardInterrupt: print("\nKeyboard interrupt received, exiting.") ``` After double-checking the docs, the current doc for `protocol_version` [1] is quite clear about this: "your server must then include an accurate Content-Length header (using send_header()) in all of its responses to clients" I still think the fix I proposed is an improvement. Setting a Content-Length isn't forbidden in HTTP/1.0 , and it guarantees good behavior when HTTP/1.1 is used. [1] https://docs.python.org/3/library/http.server.html#http.server.BaseHTTPRequestHandler.protocol_version -- ___ Python tracker <https://bugs.python.org/issue43972> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43972] Simple HTTP Request Handler in http.server does not set a content-length and does not close connections on 301s
Change by Stephen Rosen : -- keywords: +patch pull_requests: +24395 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25705 ___ Python tracker <https://bugs.python.org/issue43972> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43972] Simple HTTP Request Handler in http.server does not set a content-length and does not close connections on 301s
New submission from Stephen Rosen : If you use the `http.server` simple server and handler to serve a directory, navigating to a directory name without a trailing slash will trigger a 301 to add the trailing slash. For example, if "foo/" is a directory under the file server, a GET for "/foo" will receive a 301 Moved Permanently response with a Location header pointing at "/foo/". However, the response is sent without a "Content-Length: 0" and the connection is not closed. Unfortunately, certain clients will hang indefinitely and wait under these conditions, without processing the redirect. In my testing, curl 7.68 and Firefox 87 both exhibted this behavior. If a Content-Length header is set, these clients behave correctly. For example, subclass the handler and add def send_response(self, code): super().send_response(code) if code == HTTPStatus.MOVED_PERMANENTLY: self.send_header("Content-Length", "0") -- components: Library (Lib) messages: 392272 nosy: sirosen priority: normal severity: normal status: open title: Simple HTTP Request Handler in http.server does not set a content-length and does not close connections on 301s versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue43972> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17519] unittest should not try to run abstract classes
Stephen Thorne added the comment: I have done some experimentation here and thought through this feature request. The concept we are trying to deliver is: "I would like to share functionality between test classes, by having an abstract parent, with concrete leaves" The metaclass abc.ABCMeta provides functionality that means two things: - any class with this metaclass (so the class and all its subclasses, typically) that have @abc.abstractmethod or @abc.abstractproperty decorated methods will be treated as abstract - any class that is treated as abstract will raise an exception immediately, to make it clear to the programmer (and unit tests) that a programming error has occured. Following this through, we end up with two ways in which this can go wrong in unit testing if we ask our unit testing framework to not test abstract classes. This is a complete example, with both failure modes illustrated: Consider: class AbstractTestCase(unittest.TestCase, metaclass=abc.ABCMeta): ... class FooTest(AbstractTestCase): def foo(self): return 1 In this case, AbstractTestCase will not be skipped: this is because without any abstract methods inside it: it's not actually considered 'abstract', and is a concrete class. In the second case: class AbstractTestCase(unittest.TestCase, metaclass=abc.ABCMeta): @abc.abstractmethod def foo(self): ... @abc.abstractmethod def bar(self): ... class FooTest(AbstractTestCase): def foo(self): return 1 In this case, because AbstractTestCase has 2 abstract methods, it will be skipped. No tests run. But also FooTest will be skipped because it has 1 abstract method, and is therefore also abstract. If this were a 'normal' program, we would see an exception raised when FooTest is instanciated, but because we're skipping tests in abstract classes, we skip all the tests and exit with success. My gut feeling on this is that what we really want is a decorator that says: Skip this class, and only this class, explicitly. All subclasses are concrete, only this one is abstract. -- nosy: +sthorne ___ Python tracker <https://bugs.python.org/issue17519> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42844] Turtle Module -- "onclick" arguments enchancement
Change by Stephen : -- keywords: +patch pull_requests: +22972 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24143 ___ Python tracker <https://bugs.python.org/issue42844> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42844] Turtle Module -- "onclick" arguments enchancement
New submission from Stephen : I have created an enhancement in the Turtle module. When a programmer wants to have an action performed after clicking on a Turtle object, the programmer is currently unable to supply any arguments into the method that is run when "on_clicked" which is extremely limiting, especially to beginners who are looking to modify multiple objects on the screen at one time, such as in a game. I have modified the implementation of the “on_clicked” method to be able to provide keyword arguments into the method through a dictionary that is later unpacked into the target method. Attached is an example of the benefits of this enhancement to the turtle module. -- components: Library (Lib) files: on_click_arguments_example.py messages: 384513 nosy: sc1341 priority: normal severity: normal status: open title: Turtle Module -- "onclick" arguments enchancement type: enhancement versions: Python 3.10 Added file: https://bugs.python.org/file49723/on_click_arguments_example.py ___ Python tracker <https://bugs.python.org/issue42844> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19500] ftplib: Add client-side SSL session resumption
Change by Stephen Ash : -- nosy: -Stephen Ash ___ Python tracker <https://bugs.python.org/issue19500> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41092] Report actual size from 'os.path.getsize'
Change by Stephen Finucane : -- keywords: +patch pull_requests: +20254 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21088 ___ Python tracker <https://bugs.python.org/issue41092> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41092] Report actual size from 'os.path.getsize'
New submission from Stephen Finucane : The 'os.path.getsize' API returns the apparent size of the file at *path*, that is, the number of bytes the file reports itself as consuming. However, it's often useful to get the actual size of the file, or the size of file on disk. It would be helpful if one could get this same information from 'os.path.getsize'. -- components: Library (Lib) messages: 372183 nosy: stephenfin priority: normal severity: normal status: open title: Report actual size from 'os.path.getsize' type: enhancement versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue41092> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40932] subprocess docs don't qualify the instruction to use shlex.quote by OS
New submission from Stephen Farris : The subprocess docs state: "When using shell=True, the shlex.quote() function can be used to properly escape whitespace and shell metacharacters in strings that are going to be used to construct shell commands." While this is true on Unix, it is not true on Windows. On Windows it is easy to create scenarios where shell injection still exists despite using shlex.quote properly (e.g. subprocess.run(shlex.quote("' '"), shell=True) launches the Windows calculator, which it wouldn't do if shlex.quote was able to prevent shell injection on Windows). While the shlex docs state that shlex is for Unix, the subprocess docs imply that shlex.quote will work on Windows too, possibly leading some developers to erroneously use shlex.quote on Windows to try to prevent shell injection. Recommend: 1) qualifying the above section in the subprocess docs to make it clear that this only works on Unix, and 2) updating the shlex docs with warnings that shlex.quote in particular is not for use on Window s. -- assignee: docs@python components: Documentation messages: 371140 nosy: Stephen Farris, docs@python priority: normal severity: normal status: open title: subprocess docs don't qualify the instruction to use shlex.quote by OS versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue40932> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40932] subprocess docs don't qualify the instruction to use shlex.quote by OS
Change by Stephen Farris : -- type: -> security ___ Python tracker <https://bugs.python.org/issue40932> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39673] Map errno==ETIME to TimeoutError
Stephen J. Turnbull added the comment: First, let me say I like Giampaolo's TimeoutExpired *much* better as the name for this kind of exception! But that ship has sailed. I don't understand Giampaolo's comment. If I understand the claim correctly, the problem is that people who should be catching some application-specific exception may be misled into catching TimeoutError instead, or into trying to get application-specific attributes from TimeoutError. But that ship sailed with the creation of TimeoutError. (We have a whole fleet sailing with this exception.) Unless Giampaolo is proposing to deprecate TimeoutError? I'm sympathetic ;-), but deprecation is a PITA and takes forever. If we're not going to deprecate, it seems to me that it's much more developer-friendly to catch ETIME with TimeoutError, as that seems very likely to be the expected behavior. It's true that even if Giampaolo changes TimeoutExpired to subclass TimeoutError, generic TimeoutError won't have .seconds. But if you catch a TimeoutExpired with TimeoutError, that instance *will* have .seconds, and if you try to get .seconds on generic TimeoutError, you'll get a different uncaught exception (AttributeError vs. TimeoutError), but that TimeoutError wouldn't have been handled by catching TimeoutExpired. I agree with Eric that people who were distinguishing OSError with .errno=ETIME from TimeoutError might be at risk, but I wouldn't do that: if I were going to be distinguishing particular OSErrors on the basis of errno (other than in "Unexpected OSError (errno = %d)" reporting style), I'd just catch OSError and do that. On the other hand, I might expect TimeoutError to catch ETIME. And Giampaolo says he's never seen either. I suppose the author of psutil would be as likely as anyone to have seen it! On net (unless we go the deprecation route) it seems that the convenience and "intuition" of adding ETIME to TimeoutError outweighs that risk. I wish there were somebody who was there at the creation of ETIME! -- nosy: +sjt ___ Python tracker <https://bugs.python.org/issue39673> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40219] ttk LabeledScale: label covered by hidden element
Change by Stephen Bell : -- type: -> behavior ___ Python tracker <https://bugs.python.org/issue40219> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40219] ttk LabeledScale: label covered by hidden element
New submission from Stephen Bell : The LabeledScale in tkinter.ttk seems to have some kind of hidden element that covers the LabeledScale's label when the value is set to mid-scale. Tested on Windows 10, Python 3.6 See below code to reproduce: import tkinter from tkinter import ttk master = tkinter.Tk() _out1Value = tkinter.IntVar(master) out1Slider = ttk.LabeledScale(master, from_=-100, to=100, variable=_out1Value, compound="bottom") _out1Value.set(0) # uncomment to "fix" # out1Slider.label.lift() out1Slider.pack() master.mainloop() -- components: Tkinter messages: 365940 nosy: Stephen Bell priority: normal severity: normal status: open title: ttk LabeledScale: label covered by hidden element versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue40219> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39548] Request fails when 'WWW-Authenticate' header for Digest Authentication does not contain 'qop'
Change by Stephen Balousek : -- versions: +Python 3.7 ___ Python tracker <https://bugs.python.org/issue39548> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38686] WWW-Authenticate qop="auth,auth-int" rejected by urllib
Change by Stephen Balousek : -- pull_requests: +17752 pull_request: https://github.com/python/cpython/pull/18338 ___ Python tracker <https://bugs.python.org/issue38686> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39548] Request fails when 'WWW-Authenticate' header for Digest Authentication does not contain 'qop'
Change by Stephen Balousek : -- keywords: +patch pull_requests: +17711 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18338 ___ Python tracker <https://bugs.python.org/issue39548> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39548] Request fails when 'WWW-Authenticate' header for Digest Authentication does not contain 'qop'
New submission from Stephen Balousek : When making an HTTP request using an opener with an attached HTTPDigestAuthHandler, the request causes a crash when the returned 'WWW-Authenticate' header for the 'Digest' domain does not return the optional 'qop' value. Response headers: = Content-Type: application/json Content-Security-Policy: default-src 'self' 'unsafe-eval' 'unsafe-inline';img-src 'self' data: X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Content-Length: 600 WWW-Authenticate: Digest realm="ServiceManager", nonce="1580815098100956" WWW-Authenticate: Basic realm="ServiceManager", charset="UTF-8" Cache-Control: max-age=0, no-cache, no-store, must-revalidate Expires: 0 Pragma: no-cache Crash: == Error: Exception: 'NoneType' object has no attribute 'split' Traceback (most recent call last): ... File "/home/sbalousek/bin/restap.py", line 1317, in RunTest status, payload, contentType = ExecuteRequest(baseUrl, test, tap); File "/home/sbalousek/bin/restap.py", line 1398, in ExecuteRequest response= opener.open(request, payload, timeout); File "/usr/lib/python3.8/urllib/request.py", line 523, in open response = meth(req, response) File "/home/sbalousek/bin/restap.py", line 1065, in http_response return self.process_response(request, response, HTTPErrorProcessor.http_response); File "/home/sbalousek/bin/restap.py", line 1056, in process_response return handler(self, request, response); File "/usr/lib/python3.8/urllib/request.py", line 632, in http_response response = self.parent.error( File "/usr/lib/python3.8/urllib/request.py", line 555, in error result = self._call_chain(*args) File "/usr/lib/python3.8/urllib/request.py", line 494, in _call_chain result = func(*args) File "/usr/lib/python3.8/urllib/request.py", line 1203, in http_error_401 retry = self.http_error_auth_reqed('www-authenticate', File "/usr/lib/python3.8/urllib/request.py", line 1082, in http_error_auth_reqed return self.retry_http_digest_auth(req, authreq) File "/usr/lib/python3.8/urllib/request.py", line 1090, in retry_http_digest_auth auth = self.get_authorization(req, chal) File "/usr/lib/python3.8/urllib/request.py", line 1143, in get_authorization if 'auth' in qop.split(','): AttributeError: 'NoneType' object has no attribute 'split' Diagnosis: == The crash is a result of an optional 'qop' value missing from the 'WWW-Authenticate' header. This bug was introduced in changes for issue 38686. -- components: Library (Lib) messages: 361330 nosy: Stephen Balousek priority: normal severity: normal status: open title: Request fails when 'WWW-Authenticate' header for Digest Authentication does not contain 'qop' type: crash versions: Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue39548> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37903] IDLE Shell sidebar.
Stephen Paul Chappell added the comment: @rhettinger: The turtle demo is easily accessible through the menus via Help > Turtle Demo. It is nice to see there are others interested in IDLE's improvement. :-) -- ___ Python tracker <https://bugs.python.org/issue37903> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37903] IDLE Shell sidebar.
Stephen Paul Chappell added the comment: Zero: "not to have them added as text as is usual in a terminal window" taleinat: "removing prompts from the shell window's text widget" Zero: "print the values of ps1 and ps2 in the proposed ShellIO subclass" taleinat: "separate sidebar showing where prompts and user input were" We appear to be in agreement. terry.reedy: "Labels, such as '>>>', 'Out', 'Inp', and 'Err' would be used" Zero:"Having IDLE react to sys.ps1 and sys.ps2" My suggestion is to take those labels terry.reedy talks about from the values of ps1 and ps2 since they are already documented and standard for "the interpreter ... in interactive mode." If psX needs to introduced for other prompts that may be needed ("Maybe use 'Con', maybe use Dbg and Wrn."), it would provide a sensible way to customize those labels as well. -- ___ Python tracker <https://bugs.python.org/issue37903> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37903] IDLE Shell sidebar.
Stephen Paul Chappell added the comment: Maybe my impression has been false this whole time, but the Python interactive interpreter seems to be very similar to the IDLE shell window. My question is, "Why not make them even more so?" Having IDLE react to sys.ps1 and sys.ps2 opens up the shell to similar use cases as having them defined in the interactive interpreter. My suggestion is not to have them added as text as is usual in a terminal window but to print the values of ps1 and ps2 in the proposed ShellIO subclass. That would make label customization possible in a way that is already documented and standard. -- ___ Python tracker <https://bugs.python.org/issue37903> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6188] Error Evaluating float(x) ** float(y)
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue6188> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21957] ASCII Formfeed (FF) & ASCII Vertical Tab (VT) Have Hexadecimal Representation
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue21957> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24185] Add Function for Sending File to Trash (or Recycling Bin)
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue24185> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21402] tkinter.ttk._val_or_dict assumes tkinter._default_root exists
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue21402> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18601] Example "command-line interface to difflib" has typographical error
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue18601> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21537] functools.lru_cache does not cache exceptions
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue21537> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18558] Iterable glossary entry needs clarification
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue18558> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue31848> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31476] Stdlib source files not installed
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue31476> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7676] IDLE shell shouldn't use TABs
Change by Stephen Paul Chappell : -- nosy: -Zero ___ Python tracker <https://bugs.python.org/issue7676> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37903] IDLE Shell sidebar.
Stephen Paul Chappell added the comment: The documentation for sys.ps1 and sys.ps2 states that they "are only defined if the interpreter is in interactive mode." Since the IDLE shell is meant to be interactive (and to reduce the differences between the shell and running Python directly), would it be helpful if ps1 and ps2 were defined when running IDLE? The shell could then honor their values. If such a direction was explored, one issue may be that the sidebar could not simply be 3 char wide. The documentation also states that non-strings are evaluated each time they are needed by the interpreter. This allows for such interesting possibilities as shown with the code below but may not be desired functionality for the IDLE shell window. import sys from datetime import datetime class TimePrompt: def __init__(self, prefix, suffix): self.prefix, self.suffix = prefix, suffix def __str__(self): return f'{self.prefix}{datetime.now()}{self.suffix}' sys.ps1, sys.ps2 = TimePrompt('', ' >>> '), TimePrompt('', ' ... ') -- nosy: +Zero ___ Python tracker <https://bugs.python.org/issue37903> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38636] IDLE regression: toggle tabs and change indent width functions
Stephen Paul Chappell added the comment: When I start IDLE and the shell window appears, my first task is to press "Alt + T" to change from using tabs to spaces and then "Alt + U" to change from using 8 spaces to 4. This allows code pasted from the shell into an editor window or other IDE to not require reformatting since those settings seem to be common for Python code. If the defaults for these settings were to be exposed in IDLE's settings under the General tab (maybe near the new "Show line numbers in new windows" checkbox), would it be best to make that request here or to open a new bug with an enhancement suggestion? -- ___ Python tracker <https://bugs.python.org/issue38636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38636] "Alt + T" and "Alt + U" Broken in IDLE on Windows
New submission from Stephen Paul Chappell : In the latest Python 3.8.0 installation when running IDLE on Windows, pressing "Alt + T" generates the following error: Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\Python38\Lib\tkinter\__init__.py", line 1883, in __call__ return self.func(*args) File "C:\Program Files\Python38\Lib\idlelib\multicall.py", line 176, in handler r = l[i](event) TypeError: toggle_tabs_event() missing 1 required positional argument: 'event' Similarly, pressing "Alt + U" will generate a very similar error: Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\Python38\Lib\tkinter\__init__.py", line 1883, in __call__ return self.func(*args) File "C:\Program Files\Python38\Lib\idlelib\multicall.py", line 176, in handler r = l[i](event) TypeError: change_indentwidth_event() missing 1 required positional argument: 'event' -- assignee: terry.reedy components: IDLE, Windows messages: 355678 nosy: Zero, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware priority: normal severity: normal status: open title: "Alt + T" and "Alt + U" Broken in IDLE on Windows type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue38636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38365] Issue 38363 - False Alarm - Sorry!
New submission from Stephen Tucker : Hi, Issue 38363 is a false alarm - I am sorry to have wasted your time. My mistake was that the file that had the BOM in it also had a space at the end of the filename. I removed the space and the module was found OK. Sorry again. Stephen Tucker. -- messages: 353854 nosy: Stephen_Tucker priority: normal severity: normal status: open title: Issue 38363 - False Alarm - Sorry! ___ Python tracker <https://bugs.python.org/issue38365> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38363] No Module named ..." and UTF-8 Byte Order Marks
New submission from Stephen Tucker : Hi, I am running Python 2.7.10 on Windows 10. I have discovered that if a .py source text file (that is, a Module text file) starts with a UTF-8 Byte Order Mark, the module does not get "found" by the import statement. I have just spent an inordinate amount of time reaching this conclusion. I realise that 2.7.10 is probably not being supported any more, however, please let me ask the questions anyway: Could ... Either: ... the error message please be more helpful? (Like, for example, "Module begins with a Byte Order Mark") Or:... the BOM be allowed at the start of a Module? Thanks. Stephen Tucker. -- messages: 353841 nosy: Stephen_Tucker priority: normal severity: normal status: open title: No Module named ..." and UTF-8 Byte Order Marks ___ Python tracker <https://bugs.python.org/issue38363> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28609] argparse claims '*' positional argument is required in error output
Stephen McDowell added the comment: > For optionals, `required` is set by the programmer. But for positionals it > is set with: ... > So for '?' argument, required is False. But for '*', it must also have a > 'default' parameter (not just the default None). > So the proposed patch is overriding the 'required' value that was set during > 'add_argument'. And issuing this error message is the main purpose of the > 'required' attribute. nargs='*' being marked as `required` is incorrect though, isn't it? I was also very confused by this behavior, the only reason I found this bug was to search before opening new, and had a patch prepared that is nearly identical to the one here. 1. It's really helpful to know about explicitly setting `default=None|[]` depending on use case. Would a docs PR briefly explaining at the bottom of the nargs [a] docs explaining how to change the error message via `default` be welcome? This is a slightly challenging problem to search for. 2. My understanding is the ultimate rejection of the patch is because it's bypassing the `required` attribute. So to fix this adequately, changing ? and * to not show up as required (when no `default` provided) should be done? [a] https://docs.python.org/3/library/argparse.html#nargs -- nosy: +svenevs ___ Python tracker <https://bugs.python.org/issue28609> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34442] zlib module not built on windows
New submission from Stephen Kelly : I tried to build python 3.7.0 from source. I ran the PCBuild/build.bat script. That downloaded zlib to the external/ directory. However, it does not seem to be built. When running I get: python\3.7.0\lib\zipfile.py", line 646, in _check_compression "Compression requires the (missing) zlib module") RuntimeError: Compression requires the (missing) zlib module I examined PCBuild/pcbuild.proj. It makes no mention of zlib, though it mentions other externals. I notice that Python 3.6.1 contained zlib in Modules/zlib instead of coming from external/. Presumably that source was moved, but the Windows-related scripts were not updated. -- components: Extension Modules messages: 323791 nosy: steveire priority: normal severity: normal status: open title: zlib module not built on windows type: compile error versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue34442> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29595] Expose max_queue_size in ThreadPoolExecutor
Stephen ONeal <stephen.oneal...@gmail.com> added the comment: My project we're going into the underlying _work_queue and blocking adding more elements based on unfinished_tasks to accomplish this, bubbling this up to the API would be a welcome addition. -- nosy: +stephen.oneal...@gmail.com ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue29595> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33035] Some examples in documentation section 4.7.2 are incorrect
New submission from Stephen Wille Padnos <st...@thothsystems.com>: Section 4.7.2 of the documentation, "Keyword Arguments", has several examples of valid calls to the sample function parrot. The function definition is: def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'): The last two calls in the valid samples are actually not valid, since they are missing the required "voltage" parameter. parrot('a million', 'bereft of life', 'jump') # 3 positional arguments parrot('a thousand', state='pushing up the daisies') # 1 positional, 1 keyword They should be changed to include a value for voltage, along with a change to the comment: parrot(1000, 'a million', 'bereft of life', 'jump') # 4 positional arguments parrot(1000, 'a thousand', state='pushing up the daisies') # 2 positional, 1 keyword This issue is present in all currently available versions of the documentation: 2.7; 3.5; 3.6.4; pre (3.7); and dev (3.8). -- assignee: docs@python components: Documentation messages: 313485 nosy: docs@python, stephenwp priority: normal severity: normal status: open title: Some examples in documentation section 4.7.2 are incorrect type: enhancement versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33035> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32325] C API should use 'const char *' instead of 'char *'
New submission from Stephen Kelly <steve...@gmail.com>: When using C++ to extend python, one may use PyGetSetDef for example: static PyGetSetDef Noddy_getseters[] = { {"first", (getter)Noddy_getfirst, (setter)Noddy_setfirst, "first name", NULL}, {"last", (getter)Noddy_getlast, (setter)Noddy_setlast, "last name", NULL}, {NULL} /* Sentinel */ }; However, in C++ implicit conversion from const char* to char* is deprecated since C++98, and is a removed conversion in C++11. https://godbolt.org/g/sswUKM GCC/Clang warn about this, and MSVC in conformance mode (/permissive-) errors on it. PyGetSetDef and similar APIs should use const char* instead of char* for members such as `name`. -- components: Library (Lib) messages: 308316 nosy: steveire priority: normal severity: normal status: open title: C API should use 'const char *' instead of 'char *' type: enhancement versions: Python 3.8 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32325> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24132] Direct sub-classing of pathlib.Path
Stephen M. Gava <elgua...@python.net> added the comment: @paul.moore is the original contributor mia? i seem to remember pathlib as once being marked 'provisional', i think it should have stayed that way until this problem was resolved. easy to say i know ;) when i don't have a patch. @projetmbc yes i found various work-arounds on the web and decided to not use any of them. really i feel this should be fixed as it's a jarring inconsistency with naturally expected behaviour for a class in python. so i added my report to this as a topic bump because i don't think this should be forgotten about and in case anyone might come up with an idea how to fix it. -- versions: +Python 3.6 -Python 3.5 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue24132> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24132] Direct sub-classing of pathlib.Path
Stephen M. Gava <elgua...@python.net> added the comment: Using a set of paths with special properties and formats in a project, thought "the cleanest oop way to do this is try out python's oop paths in pathlib". Subclassed Path to implement my extra (non platfor specific) properties and fell at the first hurdle because of this issue... for me pathlib does not provide oop paths if i can't subclass Path, for whatever reason. reverted to treating paths as strings and writing functions to handle my special path properties and formats. i was also surprised when i found another bug report on this issue that said it was closed for 3.7, great i thought this has been solved, but no, the other report was closed because it was about the same issue as this ancient report. -- nosy: +elguavas ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue24132> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"
New submission from Stephen Paul Chappell <noctis.skyto...@gmail.com>: When Aifc_read runs initfp, it conditionally sets self._ssnd_chunk and is not guaranteed to do so. At the bottom of the method, a check is made to see if the attribute has a false value; and if so, an error is supposed to be raised. If a SSND chunk is never found, checking self._ssnd_chunk causes an attribute error to be raised similar to this: AttributeError: 'Aifc_read' object has no attribute '_ssnd_chunk' The error was found on the following distribution: Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32 -- components: Library (Lib), Tests messages: 304804 nosy: Zero priority: normal severity: normal status: open title: "aifc" module does not always initialize "Aifc_read._ssnd_chunk" type: crash versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31848> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31660] sys.executable different in os.execv'd python3.6 virtualenv session in python2 vs python3
Stephen Moore <delfick...@gmail.com> added the comment: I just realised python3 sets it's own __PYVENV_LAUNCHER__ and if you unset it before calling to os.execv, then the virtualenv has the correct sys.executable. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31660> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31660] sys.executable different in os.execv'd python3.6 virtualenv session in python2 vs python3
Stephen Moore <delfick...@gmail.com> added the comment: It appears the problem doesn't appear when using python3 -m venv. Also it seems __PYVENV_LAUNCHER__ is set to the virtualenv's python except when it's a python3.6 virtualenv and we os.execv from python3.6, where it's set the system python. Should I be making an issue with the virtualenv project? -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31660> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31660] sys.executable different in os.execv'd python3.6 virtualenv session in python2 vs python3
New submission from Stephen Moore <delfick...@gmail.com>: Hi, I've come across a problem whereby if you do an os.execv to a python3.6 virtualenv python inside python2.7 vs python3.6 then the resulting python session has a different sys.executable. Where if you os.execv from python2.7 the sys.executable is equal to the virtualenv python Whereas from python3.6 the resulting python session has a sys.executable of the system python. An example of this in play can be found at https://gist.github.com/delfick/d750dc83e3b28e90cef8e2bfbd5b175a Note that I don't see the problem if the virtualenv is based on python2.7 (https://gist.github.com/delfick/f1ad6872e2614189a7d98f2583ffc564) -- components: macOS messages: 303507 nosy: Stephen Moore, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: sys.executable different in os.execv'd python3.6 virtualenv session in python2 vs python3 versions: Python 2.7, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31660> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31476] Stdlib source files not installed
Stephen Paul Chappell added the comment: The URL for the installer that was used last is: https://www.python.org/ftp/python/3.6.2/python-3.6.2-amd64-webinstall.exe -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31476> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31476] "Open Module..." Not Working in IDLE for Standard Library
New submission from Stephen Paul Chappell: Ever since Python 3.6.1, trying to open a Python-source library module in IDLE on Windows (10) has not worked properly since the installer has only been providing *.pyc files. Learning how to use Python has always been easy since it (1) has a great help document, (2) makes it easy to get help() on objects, and (3) allows the source to easily be explored and/or patched. Is there something special that needs to be done to get both the standard library's *.py files and precompile them to *.pyc during installation? I would be glad to run further tests if the Windows installer can be run headless with specific command-line arguments. -- assignee: terry.reedy components: IDLE, Library (Lib), Windows messages: 302201 nosy: Zero, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware priority: normal severity: normal status: open title: "Open Module..." Not Working in IDLE for Standard Library type: behavior versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31476> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31125] shelve.open of temporary file fails with error "anydbm.error: db type could not be determined"
New submission from Stephen Larroque: This is a followup of issue 23174. When using `shelve.open(tempfile.mkstemp()[1])`, the shelve (or anydbm or dumbdbm) fail with "anydbm.error: db type could not be determined". Instead, the module could detect the file is empty and use it as if it were not existing before ('c' or 'n' flag). For the moment, there is no way around except creating the temporary file and then delete it. -- components: IO messages: 299790 nosy: Stephen Larroque priority: normal severity: normal status: open title: shelve.open of temporary file fails with error "anydbm.error: db type could not be determined" type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31125> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30251] Windows Visual Studio solution does not have an install target
Stephen Kelly added the comment: This is resolved as not a bug. Is there a way to convert it to a feature request? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30251> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30905] Embedding should have public API for interactive mode
New submission from Stephen Kelly: Consider the following three snippets: 1) const char* sourceCode = "a = 9\n" "a"; // This is OK! Python runs both lines. // BUT: The value of 'a' is not printed PyRun_StringFlags(sourceCode, Py_file_input, localDictionary, localDictionary, 0); 2) // This is OK! We run one statement at a time: PyRun_StringFlags("a = 9", Py_single_input, localDictionary, localDictionary, 0); // Python prints the value of 'a' because we use Py_single_input! PyRun_StringFlags("a", Py_single_input, localDictionary, localDictionary, 0); 3) const char* sourceCode = "a = 9\n" "a"; // This is NOT OK! Python throws a SyntaxError because we used Py_single_input. PyRun_StringFlags(sourceCode, Py_single_input, localDictionary, localDictionary, 0); The intention is to be able to run script code in an interpreter built into an application, and to maintain two user features: 1) The behavior is the same as the standard python interpreter with regard to printing values automatically without requiring the print() statement. 2) It is allowed to copy/paste possibly multiple lines/statements and execute them These two requirements are in conflict, because while Py_single_input enables the first, it forbids the second. I have worked around this by using internal API in Python-ast.h and setting `mod->kind = Interactive_kind;` before calling `PyAST_CompileEx`, but that should not be needed. -- components: Interpreter Core messages: 298162 nosy: steveire priority: normal severity: normal status: open title: Embedding should have public API for interactive mode versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30905> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1360] Queue.get() can't be interrupted with Ctrl-C unless timed out
Stephen Rosen added the comment: Can a note be added to the Queue.get() documentation? This behavior has been known to be at least potentially confusing for a decade, and there's no mention of it in the documentation. -- nosy: +Stephen Rosen versions: +Python 2.7 -Python 2.5 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1360> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30253] Python does not build without WITH_THREADS defined on Windows/Visual Studio
New submission from Stephen Kelly: As there is no configuration system for python on Windows (issue30252) I tried to change pyconfig.h to comment out some lines: // #define NT_THREADS // #define WITH_THREAD After building, I had to additionally patch * threadmodule.c and thread.c to exclude all content (I don't know if there is a way to exclude the file entirely with the Python build system - there should be something like that as part of a configure system). * Wrap uses of PyThread_get_thread_ident() in ifdefs in timemodule.c. This is surprising because I would expect it to not compile on any platform without the ifdefs. -- components: Build messages: 292879 nosy: steveire priority: normal severity: normal status: open title: Python does not build without WITH_THREADS defined on Windows/Visual Studio versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30253> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30252] Configuration system does not work for Windows/Visual Studio
New submission from Stephen Kelly: As far as I know, there is a configuration system for python based on the configure script. Python can be configured with --without-threads to disable threading support. There is no equivalent system for Windows/Visual Studio. This makes it harder to build python with configurations. -- components: Build messages: 292874 nosy: steveire priority: normal severity: normal status: open title: Configuration system does not work for Windows/Visual Studio versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30252> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30251] Windows Visual Studio solution does not have an install target
New submission from Stephen Kelly: The Windows Visual Studio solution does not have an install target. As far as I understand, the configure system used on Unix does have an install target. That means that on Windows, binaries resulting from the build to not end up in the same layout as result from using the official installer. Third party modules expect the same layout. For example, Sip/PyQt requires it https://www.riverbankcomputing.com/pipermail/pyqt/2017-April/039109.html . There are probably other modules similarly affected. I don't know what else an install target should do, but I note its absence. -- components: Build messages: 292872 nosy: steveire priority: normal severity: normal status: open title: Windows Visual Studio solution does not have an install target versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30251> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29352] provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences
Stephen J. Turnbull added the comment: I prefer Josh's wording. The important point to me is that >>> [1, 2][2:0] = "AB" [1, 2, "A", "B"] not an error or ["B", "A"] == [1, 2][2:0:-1]. I think too much talk about the endpoints obscures this important fact. (I think I'd like it to be an error, since the interpretation of s[2:0] = t could reasonably be any of s[0:0] = t, s[1:1] = t, or s[2:2] = t, but I haven't thought carefully enough yet, and "backward compatibility".) Note: Josh's wording is already used in 3.7 (https://docs.python.org/dev/library/stdtypes.html#common-sequence-operations, as of the timestamp of this message). I didn't check if it's been backported. -- nosy: +sjt ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29352> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30138] Incorrect documentation of replacement of slice of length 0
Stephen J. Turnbull added the comment: Sorry, I just realized this note only applies to slices with a stride (k in i:j:k). Closing. -- stage: -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30138> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30138] Incorrect documentation of replacement of slice of length 0
New submission from Stephen J. Turnbull: In section 4.6.3. "Mutable Sequence Types" of current documentation, Note 1 to the table says "[iterable] t must have the same length as the slice it is replacing." This is incorrect in the case of extension: s[len(s):] = t according to the rest of the documentation, as well as experiment. -- assignee: docs@python components: Documentation keywords: easy messages: 292127 nosy: docs@python, sjt priority: normal severity: normal status: open title: Incorrect documentation of replacement of slice of length 0 type: behavior versions: Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30138> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30060] Crash on Py_Finalize if Py_NoSiteFlag is used
Stephen Kelly added the comment: The issue http://bugs.python.org/issue17978 has a quite similar backtrace and there is discussion in http://bugs.python.org/issue17703#msg241412 about changing the TRASHCAN macro to access the _PyThreadState_Current directly instead of calling PyThreadState_Get (which is fatal for a nullptr). The very next thing the TRASHCAN macro does is check if the thread state is nullptr in a non-fatal way. Is there a reason not to apply that patch? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30060> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30060] Crash on Py_Finalize if Py_NoSiteFlag is used
Stephen Kelly added the comment: I found that if I build and run this code with Python 3, then I get a very different backtrace. KernelBase.dll!7ff963466142() Unknown python36_d.dll!Py_FatalError(const char * msg) Line 1457C python36_d.dll!PyEval_AcquireLock() Line 253C mn.exe!main(int argc, char * * argv) Line 22C [External Code] The failure is Py_FatalError("PyEval_AcquireLock: current thread state is NULL"); So, it is not clear to me what is incorrect about this code, but presumably I have done something incorrect here? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30060> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30060] Crash on Py_Finalize if Py_NoSiteFlag is used
New submission from Stephen Kelly: When attempting to use PyImport_ImportModule("os") (or to import many other libraries), there is a crash on Py_Finalize if Py_NoSiteFlag is set. The issue appears to be the use of frozenset() as a result of importing the module. I reproduced this on Windows after building 2.7.13 with VS 2015 by applying the following patch: Python changes. --- Include\\fileobject.h +++ Include\\fileobject.h @@ -70,7 +70,7 @@ */ int _PyFile_SanitizeMode(char *mode); -#if defined _MSC_VER && _MSC_VER >= 1400 +#if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900 /* A routine to check if a file descriptor is valid on Windows. Returns 0 * and sets errno to EBADF if it isn't. This is to avoid Assertions * from various functions in the Windows CRT beginning with --- Modules\\posixmodule.c +++ Modules\\posixmodule.c @@ -529,7 +529,7 @@ #endif -#if defined _MSC_VER && _MSC_VER >= 1400 +#if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900 /* Microsoft CRT in VS2005 and higher will verify that a filehandle is * valid and raise an assertion if it isn't. * Normally, an invalid fd is likely to be a C program error and therefore --- Modules\\timemodule.c +++ Modules\\timemodule.c @@ -68,6 +70,9 @@ #if defined(MS_WINDOWS) && !defined(__BORLANDC__) /* Win32 has better clock replacement; we have our own version below. */ #undef HAVE_CLOCK +#define timezone _timezone +#define tzname _tzname +#define daylight _daylight #endif /* MS_WINDOWS && !defined(__BORLANDC__) */ #if defined(PYOS_OS2) Backtrace: KernelBase.dll!7ff963466142() Unknown > python27_d.dll!Py_FatalError(const char * msg) Line 1700C python27_d.dll!PyThreadState_Get() Line 332 C python27_d.dll!set_dealloc(_setobject * so) Line 553C python27_d.dll!_Py_Dealloc(_object * op) Line 2263 C python27_d.dll!PySet_Fini() Line 1084 C python27_d.dll!Py_Finalize() Line 526 C mn.exe!main(int argc, char * * argv) Line 40C [External Code] Reproducing code: #include int main(int argc, char** argv) { // http://www.awasu.com/weblog/embedding-python/threads // Comment this to avoid crash Py_NoSiteFlag = 1; Py_Initialize(); PyEval_InitThreads(); // nb: creates and locks the GIL // NOTE: We save the current thread state, and restore it when we unload, // so that we can clean up properly. PyThreadState* pMainThreadState = PyEval_SaveThread(); // nb: this also releases the GIL PyEval_AcquireLock(); // nb: get the GIL PyThreadState* pThreadState = Py_NewInterpreter(); assert(pThreadState != NULL); PyEval_ReleaseThread(pThreadState); // nb: this also releases the GIL PyEval_AcquireThread(pThreadState); // Can reproduce by importing the os module, but the issue actually appears // because of the use of frozenset, so simplify to that. #if 0 PyObject* osModule = PyImport_ImportModule("os"); Py_DECREF(osModule); #endif // As in abc.py ABCMeta class PyRun_SimpleString("abstractmethods = frozenset(set())"); PyEval_ReleaseThread(pThreadState); // release the interpreter PyEval_AcquireThread(pThreadState); // nb: this also locks the GIL Py_EndInterpreter(pThreadState); PyEval_ReleaseLock(); // nb: release the GIL // clean up PyEval_RestoreThread(pMainThreadState); // nb: this also locks the GIL Py_Finalize(); } -- components: Interpreter Core messages: 291568 nosy: steveire priority: normal severity: normal status: open title: Crash on Py_Finalize if Py_NoSiteFlag is used type: crash versions: Python 2.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30060> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28080] Allow reading member names with bogus encodings in zipfile
Stephen J. Turnbull added the comment: Thanks for followup! I was just about to write you, now that 3.6 is out. Season's Greetings! First, how do you propose to proceed with issue28115 ("use argparse for the ZipFile module")? If you expect to commit that first (I'm in no hurry for this patch, BTW, as long as it gets into 3.7 I'm happy), this issue should depend on it and use argparse too. I don't see any good reason for allowing non-UTF-8 encoding to a file open for writing, and a good reason (the ZipFile standard) for not allowing it. Certainly the CLI should not allow it, any more than it does now. At least in my experiments InfoZip and the default zip utilities on Windows and Mac DTRT with UTF-8 zipfiles, so there is no absolute need for writing nonconforming zipfiles. If you want to block on a convert-to-UTF-8 option I can do that (but I don't need it myself). (Note to self: if writing to existing zipfile is extension of existing file, need to prevent mixed encodings. Also warn about conversion.) I thought I checked that comments were decoded. Maybe that's only on the UTF-8 path? Or maybe I needed more coffee. (Hope so, that would be a messy problem if ASCII/Latin1 returns bytes and UTF-8 returns str!) I'll think about this. Yes, it's a backwards-compatibility issue so needs care. Would be weird if names are decoded but other metadata (comments) not, though. Surely someone would complain if they actually used comments? (I'm thinking maybe a compatibility break might be OK? With deprecation cycle?) I expect to check all execution paths accessing metadata and have a proposed patch by 12/31. I think I'm still short some tests, will check and write them if needed. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28032] --with-lto builds segfault in many situations
Stephen J. Turnbull added the comment: FWIW, XEmacs has used a bit of m4 magic to make --with-* and --enable-* equivalent for 15 years, and nobody has ever complained. The autotools convention is a distinction without a difference, and confuses users when a program feature depends on an external library (especially where there are alternative implementations). -- nosy: +sjt ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28423] list.insert(-1,value) is wrong!
New submission from stephen: python3.4.3 on linux mint 17.3 interactive mode on terminal >>> fred=[0,1,2,3,4] >>> fred.insert(-1,9) >>> fred [0, 1, 2, 3, 9, 4] We should get [0,1,2,3,4,9]. Embarrassing error! -- messages: 278541 nosy: unklestephen priority: normal severity: normal status: open title: list.insert(-1,value) is wrong! type: behavior versions: Python 3.4 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28423> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28102] zipfile.py script should print usage to stderr
Stephen J. Turnbull added the comment: CA pending (I have received PDF, but no star in tracker yet). -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28102> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28103] Style fix in zipfile.rst
New submission from Stephen J. Turnbull: Makes style of references to open modes 'r', 'a', ... more consistent. CA pending (I have received PDF, but no star in tracker yet). -- assignee: docs@python components: Documentation files: zipfile-doc-style messages: 276058 nosy: docs@python, sjt priority: normal severity: normal status: open title: Style fix in zipfile.rst versions: Python 3.7 Added file: http://bugs.python.org/file44595/zipfile-doc-style ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28103> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28102] zipfile.py script should print usage to stderr
New submission from Stephen J. Turnbull: Pointed out by Serhiy Storchaka in a different context. -- components: Library (Lib) files: zipfile-errmsg keywords: patch messages: 276056 nosy: sjt priority: normal severity: normal status: open title: zipfile.py script should print usage to stderr versions: Python 3.7 Added file: http://bugs.python.org/file44594/zipfile-errmsg ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28102> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28080] Allow reading member names with bogus encodings in zipfile
Stephen J. Turnbull added the comment: Cleaned up a few loose ends while it's all fresh in mind. Will ping python-dev in 4-6 weeks for review for 3.7. Thanks to Serhiy for review. The current version of the patch is much improved over the initial submission due to his efforts. -- Added file: http://bugs.python.org/file44593/encoded-member-names-v3 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28080] Allow reading member names with bogus encodings in zipfile
Stephen J. Turnbull added the comment: If you have a workaround that's available to nonprogrammers, I'd like to hear about it. I have found none, that's why I went to the trouble to put together a patch even though I knew that the odds of actually getting it in to Python 3.6 was very low -- my patch (or Sergey Dorofeev's, but that needs work to be applicable to trunk) does everything I've ever needed, so I suppose it would do for all the use cases so far posted (except umedoblock's encoding-guessing approach, but that can be handled by many 3rd-party encoding-guessing codecs, I think, and IMO should be). -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28080] Allow reading member names with bogus encodings in zipfile
Stephen J. Turnbull added the comment: Can't reply on Rietveld? Lost 2 hours work! Patch updated (encoded-member-names-v2), most changes accepted. Not happy about name change or default to cp437, I want this API to be hard to use and not be part of the normal process (utf-8 or cp437). Considering errors= argument, but that must default to 'strict' -- the problem this patch solves is zip utilities extracting to files with unreadable names, surrogateescape is more of the same. Two incomplete tests (assertRaisesRegex and capture main() stderr) still in progress, must do dayjob now. -- Added file: http://bugs.python.org/file44571/encoded-member-names-v2 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28080] Allow reading member names with bogus encodings in zipfile
Stephen J. Turnbull added the comment: Re: wait for 3.7 if reviewers are busy, understood. N.B. Contributor agreement is now on file (I received the PDF from python.org already). Re: existing patches: My patch is very similar in the basic approach to Sergey Dorofeev's patch in issue10614. Main differences: (1) Sergey's patch treats the "encoding" parameter as a first class citizen with a default to cp437, whereas mine treats it as a special case defaulting to None, with utf-8 and cp437 getting special treatment as the standard encodings. Subtle point, but I like it this way. (2) My patch includes support for the argument in the __main__ script. (3) Sergey's patch misses one execution path in the current code so needs update before application. The Japanese patches by umedoblock are very Japanese-centric, and worse, they try to guess the encoding by the crude method of seeing what decodes successfully. They are not acceptable IMO. Aaargh. Just noticed the Japanese in test_zipfile.py. Will change it to use \u escapes soon. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28080] Allow reading member names with bogus encodings in zipfile
Stephen J. Turnbull added the comment: I should have a contributor agreement form on file. Ned Deily suggested that I try to get this patch in before the 12 noon deadline Sept. 12, so here it is. I believe the patch is "safe" in the sense that its functionality needs to be explicitly enabled, and it should be very difficult to persuade it to inadvertantly write to any file. No existing execution paths should be changed at all. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28080] Allow reading member names with bogus encodings in zipfile
Stephen J. Turnbull added the comment: Suggested NEWS/whatsnew entry: Add a new *memberNameEncoding* argument to the ZipFile constructor, allowing :mod:`zipfile` to read filenames in non-conforming encodings from the zipfile as Unicode. This implementation assumes all member names have the same encoding. Motivation: There are applications in Japan that create zipfiles with directories containing filenames encoded in Shift JIS. There may be such software in other countries as well. As this is a violation of the Zip format definition, this library implements only an option to read such files. Done: (1) Add a memberNameEncoding argument to the main() function, which may be set from the command line with "--membernameencoding={codec}". This command line option may be used with -e or -l, but not -c or -t. There is no point to it in the latter, since the member names are not printed. (2) Add a memberNameEncoding argument to the ZipFile constructor. This is the only way to set it, so this is global to the ZipFile. (3) Add this attribute to repr. (4) Add a check that the mode is `read` in main() and in the ZipFile constructor, and if not invoke USAGE and exit or raise RuntimeError. (5) When retrieving member names in constructing ZipInfo instances, check if memberNameEncoding is set, and if so use it, unless the UTF-8 bit is set. In that case, obey the UTF-8 bit, as the specified encoding is surely user error. (6) Add a CODEC_USAGE message. (7) Update the docs (docstrings, library reference, NEWS). (8) Add tests: (a) List a zipfile's SJIS-encoded directory. (b) List a UTF-8-encoded directory and an ISO-8859-1-encoded directory as Shift-JIS. (c) Check that USAGE is invoked on attempts to write a zipfile in main(). (d) Check that an appropriate error is raised on attempts to write in other functions. Many other tests are run as well. ALL TESTS PASS. (9) Docs build without error. To do (?): (10) NEWS/whatsnew (11) Check relevant code paths are all covered by tests. (12) Review docs for clarity and organization. Not done: I don't think these are appropriate/needed at this time, but listed in case somebody thinks otherwise. (13) Add a subtype of RuntimeError (see 7d)? (14) Issue warning if both membernameencoding and utf-8 bit are set (see 4)? (15) Support InfoZip encoding extension mentioned in APPNOTE.TXT - .ZIP File Format Specification, v6.3.4. (16) Support per-member encodings (I think the zipfile standard permits, but not sure). -- keywords: +needs review status: pending -> open Added file: http://bugs.python.org/file44564/encoded-member-names ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28080] Allow reading member names with bogus encodings in zipfile
Changes by Stephen J. Turnbull <step...@xemacs.org>: -- components: Library (Lib) keywords: patch nosy: sjt priority: normal severity: normal status: open title: Allow reading member names with bogus encodings in zipfile type: enhancement versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19500] Add client-side SSL session resumption
Changes by Stephen Ash <stephen...@gmail.com>: -- nosy: +Stephen Ash ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19500> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27683] ipaddress subnet slicing iterator malfunction
Stephen Shirley added the comment: The bug appears to be in the new form of the constructor. Here's a more minimal reproduction: In python3.5: >>> list(ipaddress.IPv4Network(("127.0.0.4", 31)).hosts()) [] In python3.4 >>> list(ipaddress.IPv4Network("127.0.0.4/31").hosts()) [IPv4Address('127.0.0.4'), IPv4Address('127.0.0.5')] -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27683> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27582] Mispositioned SyntaxError caret for unknown code points
Stephen J. Turnbull added the comment: I still think the easiest thing to do would be to make all non-ASCII characters instances of "invalid_character_token", self-delimiting in the same way that operators are. That would automatically point to exactly the right place in the token stream, and requires zero changes to the error handling code. I don't have time to look at the code, but I suspect that you could handle this exactly the same way that ? and $ are handled, and maybe even use the same token type. -- nosy: +sjt ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27582> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27257] get_addresses results in traceback with a valid? header
Stephen J. Turnbull added the comment: OK, I can reproduce now. $ python3.5 Python 3.5.0 (v3.5.0:374f501f4567, Sep 17 2015, 17:04:56) [GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import email >>> with open(b'lkml-exception.mail', mode = 'r') as f: ... msg = email.message_from_file(f, policy=email.policy.SMTP) ... >>> msg.get_all('to') Traceback (most recent call last): and (except for a slight skew in line-numbering) the rest is the same as the tail of the OP. The crucial part is the policy=email.policy.SMTP argument, and evidently what's happening is that the parser assumes that the local-part of the addr-spec is non-empty. RFC5322 does permit a quoted-string to be empty, so this is a bug in the email module's parser. (I don't have a patch,sorry.) Aside: although strictly speaking it's hold-your-nose-and-avert-your-eyes legal according to RFC 5322, RFC 5321 (SMTP) does say: While the above definition for Local-part is relatively permissive, for maximum interoperability, a host that expects to receive mail SHOULD avoid defining mailboxes where the Local-part requires (or uses) the Quoted-string form[...]. I don't see a good reason for the usage in the test case, so I'd call this nonconformant to RFC 5321. I think the right way to handle it is to register a defect but let the parse succeed. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27257> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27257] get_addresses results in traceback with a valid? header
Stephen J. Turnbull added the comment: In Python 3.5, both entering the problematic header by hand with a trivial body and using email.message_from_string to parse it, and calling email.message_from_file on lkml-exception.mail, produce an email.message.Message with no defects and no traceback. Without access to mail_filter.py, it's not clear what the defect might be. -- nosy: +sjt stage: -> test needed type: -> behavior ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27257> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24185] Add Function for Sending File to Trash (or Recycling Bin)
Changes by Stephen Paul Chappell <noctis.skyto...@gmail.com>: -- nosy: +Zero ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24185> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26543] imaplib noop Debug
New submission from Stephen Evans: With the imaplib.Debug=3 (or greater) imaplib.noop() will crash if there are any untagged responses present. The _dump_ur() function has not been converted to expect bytes in the lambda variable x[1]. An abbreviate example of the 'dict' parameter would be: {'READ-WRITE': [b''], 'FETCH': [b'1 (FLAGS (\\Recent NonJunk))']} This _dump_ur() function needs converting to Python 3.x, say, change the map/lambda line to: l = map(lambda x:'%s: %r' % (x[0], x[1]), l) A sample crash inducing session produced by the attached file (using another email client to produce untagged responses for NOOP): 20:01.23 imaplib version 2.58 20:01.23 new IMAP4 connection, tag=b'LMHB' 20:01.48 CAPABILITIES: ('IMAP4REV1', 'LITERAL+', 'SASL-IR', 'LOGIN-REFERRALS', 'ID', 'ENABLE', 'IDLE', 'NAMESPACE', 'AUTH=PLAIN', 'AUTH=LOGIN') Traceback (most recent call last): File "E:/temp/imap-idle/imaplib-noop.py", line 18, in connection.noop() # Crashes here. File "C:\Python35\lib\imaplib.py", line 656, in noop self._dump_ur(self.untagged_responses) File "C:\Python35\lib\imaplib.py", line 1210, in _dump_ur self._mesg('untagged responses dump:%s%s' % (t, t.join(l))) File "C:\Python35\lib\imaplib.py", line 1209, in l = map(lambda x:'%s: "%s"' % (x[0], x[1][0] and '" "'.join(x[1]) or ''), l) TypeError: sequence item 0: expected str instance, bytes found -- components: email files: imaplib-noop.py messages: 261615 nosy: Stephen.Evans, barry, r.david.murray priority: normal severity: normal status: open title: imaplib noop Debug type: crash versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file42140/imaplib-noop.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26543> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26158] File truncate() not defaulting to current position as documented
Changes by Stephen Paul Chappell <noctis.skyto...@gmail.com>: -- nosy: +Zero ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26158> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24682] Add Quick Start: Communications section to devguide
Stephen J. Turnbull added the comment: I just reviewed again, and I agree it's ready for merge. I don't see any immediate need to add more. Unfortunately, I'm not a committer. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24682> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25437] Issue with ftplib.FTP_TLS and server forcing SSL connection reuse
Changes by Stephen Ash <stephen...@gmail.com>: -- nosy: +Stephen Ash ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25437> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16041] poplib: unlimited readline() from connection
Stephen Coulson added the comment: Broke for me today. Hacked the _MAXLINE to get around it. I don't see any size limit on multi-line in rfc. Only requirement is dot-stuffing. I think this fix might need a rethink. -- nosy: +scoulson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16041 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24682] Add Quick Start: Communications section to devguide
Stephen J. Turnbull added the comment: If the mailing list code of conduct is to be fleshed out, Paul Moore's post is a good place to start IMO: https://mail.python.org/pipermail/python-dev/2015-July/140872.html. -- nosy: +sjt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24682 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24682] Add Quick Start: Communications section to devguide
Stephen J. Turnbull added the comment: I tend to disagree with Ezio about a FAQ for general questions. A pointer to appropriate alternatives for off-topic posts in the Mailman listinfo descriptions of the various list (which can be copied into the devguide, or linked from there) will be sufficient for people who actually read such things before posting. OTOH, once there already is a misdirected post, I feel it's appropriate to say This post is off-topic here because this list is for development of Python itself, not developing applications with Python. Posts like yours are ignored by almost all participants. You will get help (possibly better than you could get on this list) on pytho...@python.org. Adding a pointer to a FAQ which just repeats the same thing is browbeating IMO. It's not like we don't have several people who have macros to say the above (and more politely than I did) who typically respond within hours to off-topic posts. What more could a FAQ say? Of course this needs to be on-list so that the poster (who usually is a little feckless rather than deliberately abusive) doesn't get spammed, and so that the multiple volunteers who handle these posts don't duplicate each other. I personally would like to see a guideline to participants that if they want to offer advice on the question itself to people, that they do so off-list. Whatever one's opinion on the utility of offering advice in response to an off-topic post, such advice is as off-topic as the question that elicits it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24682 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings
Stephen J. Turnbull added the comment: Please do not add the rehandle functions to codecs. They do not change the (duck-typed) representation of data while maintaining the semantics, they change the semantics of data while retaining the representation. I suggest a validation submodule of the unicodedata package, or perhaps a new unicodeutils package, for these functions, as well as those that just detect the surrogates, etc. Because they change the semantics of data they should be documented as potentially dangerous because they can't be inverted back to bytes without knowledge of the history of transformations they perform (and not even then in the case of the replace error handler). This matters in applications where the input bytes may have been digitally signed, for example. -- nosy: +sjt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18814 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24071] Python 2.7.8, 2.7.9 re.MULTILINE failure
New submission from Stephen Evans: A simple multiline regex fails when just the re.MULTILINE argument is used, but works when equivalent alternative methods are used. This was tested on Python2.7.8 on FreeBSD and Win32 Python2.7.9 data = re.sub(r'#.*', '', text, re.MULTILINE) # fails data = re.sub(r'(?m)#.*', '', text) # Ok data = re.sub(r'#.*', '', text, re.MULTILINE|re.DEBUG) # Ok All the expressions work correctly with Win64 Python3.4.3 The attached file has the code and with a sample of text that fails. -- components: Regular Expressions files: refail.py messages: 242205 nosy: Stephen.Evans, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: Python 2.7.8, 2.7.9 re.MULTILINE failure type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file39229/refail.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24071 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23227] Generator's finally block not run if close() called before first iteration
Stephen Drake added the comment: Ok, I can accept that. I think my mistake was to assume that because a generator has a close() method, I could treat it as a lightweight wrapper for another closeable object. But it's better to regard a generator function that wraps an iterable as something more akin to map() or filter(), and use a class if it's necessary to wrap a file such that close() is passed through. I happened to take a fresh look at this just the other day and it also occurred to me that the kind of composition I was trying to do can work if it's generators all the way down: def open_lines(name, mode='rt', buffering=-1): with open(name, mode, buffering) as f: for line in f: yield line def logged_lines(f): try: for line in f: logging.warning(line.strip()) yield line finally: f.close() lines = open_lines('yyy', 'r') if verbose: lines = logged_lines(lines) try: for line in lines: print(line) finally: lines.close() So a generator can transparently wrap a plain iterable or another generator, but not closeable objects in general. There's nothing really wrong with that, so I'm happy for this issue to be closed as invalid. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23227 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23755] tempfile.NamedTemporaryFile should be able to toggle delete
Stephen Gallagher added the comment: Oops, the temporary code I sent indicated that I was overriding the unlink() function (which I also tried, just in case __del__ was somehow protected). Neither monkeypatching unlink nor __del__ actually worked. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23755 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23755] tempfile.NamedTemporaryFile should be able to toggle delete
New submission from Stephen Gallagher: Currently, NamedTemporaryFile takes an attribute at initialization that allows it to remove the temporary file on going out of scope or else leave it around. However, it's not possible to change this after the fact. It would be a much more sensible pattern to be able to operate with auto-deletion enabled while constructing the file and then to be able to toggle this option off once the file is completed. For example, the use-case I have in mind is that I am creating a file that, once complete, will go into a well-known location. Because of known attacks, the only secure way to create this file is to generate it in a temporary location and then atomically move (os.rename()) it into its final location. This avoids time-of-check-time-of-use risks as well as avoiding overwriting the old file if something goes wrong. It would be handy if tempfile could be extended to support this operation. Additionally, I attempted to solve this by monkey-patching tempfile and overriding the __del__ function on the _TemporaryFileWrapper object to be a no-op. This works in python 2.7.9, but seems to be ignored on python 3.4.2. Example code: {{{ import tempfile import os f = tempfile.NamedTemporaryFile() os.unlink(f.name) f.unlink = lambda x: None }}} If you run that under python2, it will succeed. On Python 3, it will noisily report: Exception ignored in: bound method _TemporaryFileCloser.__del__ of tempfile._TemporaryFileCloser object at 0x7f7a24548c88 Traceback (most recent call last): File /usr/lib64/python3.4/tempfile.py, line 366, in __del__ File /usr/lib64/python3.4/tempfile.py, line 362, in close FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpqs5k6w7q' -- components: Library (Lib) messages: 239082 nosy: Stephen Gallagher priority: normal severity: normal status: open title: tempfile.NamedTemporaryFile should be able to toggle delete versions: Python 2.7, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23755 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com