[issue27497] csv module: Add return value to DictWriter.writeheader
New submission from Logan: Currently, DictWriter.writeheader() is defined like: def writeheader(self): header = dict(zip(self.fieldnames, self.fieldnames)) self.writerow(header) It would be useful to have it return the value of writerow(): def writeheader(self): header = dict(zip(self.fieldnames, self.fieldnames)) return self.writerow(header) This would useful because: 1) It would match the behavior of DictWriter.writerow 2) It would enable DictWriter.writeheader to be used in within a generator function (ala https://docs.djangoproject.com/en/1.9/howto/outputting-csv/#streaming-large-csv-files) -- messages: 270248 nosy: lsowen priority: normal severity: normal status: open title: csv module: Add return value to DictWriter.writeheader type: enhancement versions: Python 3.5, Python 3.6 ___ Python tracker <http://bugs.python.org/issue27497> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27497] csv module: Add return value to DictWriter.writeheader
Logan added the comment: @berker.peksag: Good catch, thank you. In my code base I'm using a slightly different implementation which does use an iterator, so I didn't even catch that the default django example was incorrect. @skip.montanaro: That is exactly the one-liner I'm currently using. Thank you for documenting it here in case anyone else is looking for the same. -- ___ Python tracker <http://bugs.python.org/issue27497> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor
Logan Jones added the comment: Based on my reading I’m hopeful that this change can make it in quickly once I find the time. The previous implementation didn’t care how the processes were created. I will look as soon as I can -- ___ Python tracker <https://bugs.python.org/issue44733> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11434] Python 3.2 input() does not remove "\r" at the end of returned string.
New submission from Joshua Logan : Hello, It is mentioned in the documentation for input() ( http://docs.python.org/py3k/library/functions.html#input ) that the newline is stripped from the end of the returned string. However, on Windows, it used to trim '\r\n'. Now it no longer trims '\r'. See output below: C:\>python Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 >>> name = input("What's your name? ") What's your name? Josh >>> print(name) Josh >>> print(list(name)) ['J', 'o', 's', 'h', '\r'] -- components: Windows messages: 130265 nosy: jaylogan priority: normal severity: normal status: open title: Python 3.2 input() does not remove "\r" at the end of returned string. type: behavior versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue11434> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3742] Parsing XML file with Unicode characters causes problem
New submission from Joshua Logan <[EMAIL PROTECTED]>: Python 3.0b2 will not parse the XML file located at http://rubyquiz.com/SongLibrary.xml.gz It complains of a UnicodeEncodeError 'charmap' codec can't encode character '\xc8' in position 45: ch aracter maps to I included a sample program, just in case I was doing something wrong while coding. Python 3.0b2 (r30b2:65106, Jul 18 2008, 18:44:17) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. -- components: XML files: read_song_xml.py messages: 72211 nosy: jaylogan severity: normal status: open title: Parsing XML file with Unicode characters causes problem type: behavior versions: Python 3.0 Added file: http://bugs.python.org/file11319/read_song_xml.py ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3742> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor
Logan Jones added the comment: Okay, I'm actually able to work on this again. What is the best way to make this change real. Should I be working off of main? -- ___ Python tracker <https://bugs.python.org/issue44733> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor
Change by Logan Jones : -- pull_requests: +30264 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/32187 ___ Python tracker <https://bugs.python.org/issue44733> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor
Logan Jones added the comment: Ok I now have a PR up with the features requested. Let me know if you need anything else! -- ___ Python tracker <https://bugs.python.org/issue44733> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44734] turtle: tests for Vec2D.__abs__ are too strict
Change by Logan Jones : -- keywords: +patch nosy: +loganasherjones nosy_count: 1.0 -> 2.0 pull_requests: +25885 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27343 ___ Python tracker <https://bugs.python.org/issue44734> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor
Change by Logan Jones : -- nosy: +loganasherjones ___ Python tracker <https://bugs.python.org/issue44733> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor
Logan Jones added the comment: I think I have a solution for this, but I'm pretty new to contributing. Still writing up some tests. -- ___ Python tracker <https://bugs.python.org/issue44733> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor
Change by Logan Jones : -- keywords: +patch pull_requests: +25911 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27373 ___ Python tracker <https://bugs.python.org/issue44733> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44744] [security] Open redirect attack due to insufficient validation in Urlparse
Change by Logan Jones : -- nosy: +loganasherjones ___ Python tracker <https://bugs.python.org/issue44744> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44744] [security] Open redirect attack due to insufficient validation in Urlparse
Logan Jones added the comment: I don't know if urlparse is actually "mishandling" these URLs. Looking over RFC 1808 (https://datatracker.ietf.org/doc/html/rfc1808.html) the BNF (https://datatracker.ietf.org/doc/html/rfc1808.html#section-2.2) seems to support what urlparse is reporting, at least for the first two examples. I'll try to break down each scenario. Maybe you can help me understand what you expect it to report? https : // /www.attacker.com ^ ^ ^ scheme Net loc Not a valid Delimeter netloc character, but is a valid abs_path beginning (according to the spec net_loc is allowed to be empty) https : /www.attacker.com/a/b ^ ^ schemevalid abs_path https : \www.attacker.com/a/b ^ ^ scheme This isn't actually matched anywhere in the BNF, so if anything maybe a value error should have been raised? -- ___ Python tracker <https://bugs.python.org/issue44744> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44744] [security] Open redirect attack due to insufficient validation in Urlparse
Logan Jones added the comment: If I've understood what you've written correctly, what you want is to change urlparse to use the WHATWG URL Standard (https://url.spec.whatwg.org/). I'm not a committer or anything, but that seems like a large API change and is not likely to happen quickly if at all. I'm not sure what the path forward here is. There are many options, creating a new function/module, slowly deprecating the current urlparse function, or just say it's not our problem. Hopefully someone else can weigh in. In the meantime, a project like https://pypi.org/project/whatwg-url/ claims to implement the WHATWG URL standard. -- ___ Python tracker <https://bugs.python.org/issue44744> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44920] Support UUIDv6, UUIDv7, and UUIDv8 from the new version of RFC4122
Change by Logan Jones : -- nosy: +loganasherjones ___ Python tracker <https://bugs.python.org/issue44920> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45518] Invalid example for typing
Logan Jones added the comment: Hi Bozhi. The syntax that you're referencing was added in 3.9. So if you're trying the syntax in earlier versions of Python, it won't work. The standard collections were added in PEP 585 (https://www.python.org/dev/peps/pep-0585/) I think the reason the examples use this syntax is that the previous List classes were deprecated in favor of the new syntax. Hope this helps! -- nosy: +loganasherjones ___ Python tracker <https://bugs.python.org/issue45518> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5396] os.read not handling O_DIRECT flag
Logan Gunthorpe added the comment: Paul's solution works in 3.7 if you set the buffer size to zero when calling fdopen. fd = os.open("my_file", os.O_DIRECT | os.O_RDWR) f = os.fdopen(fd, "rb+", 0) m = mmap.mmap(-1, 4096) f.readinto(m) This is according to a comment in _pyio.py: # If remaining space in callers buffer is larger than # internal buffer, read directly into callers buffer So by simply disabling the buffer (which is what we'd want for O_DIRECT anyway) readinto() works as expected. However, based on this issue, I'm a little concerned this won't be fully supported by python going forward; so use with care. -- nosy: +logang ___ Python tracker <https://bugs.python.org/issue5396> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36798] f-strings do not support top-level :=
Logan Jones added the comment: I'm going to try to tackle this. I'm not exactly sure how to go about updating the PEP, but the docs should have a PR in the next 15 minutes or so. -- nosy: +Logan Jones ___ Python tracker <https://bugs.python.org/issue36798> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36798] f-strings do not support top-level :=
Change by Logan Jones : -- keywords: +patch pull_requests: +13021 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issue36798> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36022] [Security] logging.config should not use eval()
Logan Jones added the comment: I'd like to work on this during the Pycon sprints -- nosy: +loganasherjones ___ Python tracker <https://bugs.python.org/issue36022> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15305] Test harness unnecessarily disambiguating twice
Logan Jones added the comment: I'm working on this in the PyCon 2019 sprints. Near as I can tell, while this issue still seems relevant, I think it might actually be for the best that this multiple disambiguation is left in the test suite. I removed the pid reference in the TESTFN and the tests passed in both the parallel and sequential cases. However, removing the pid results in multiprocessing tests having to be written more carefully if they choose to use the TESTFN. Here is an explanation for why you would leave this code in. When running the tests in sequential mode, the tests will run in a CWD that includes the pid. When writing a multi-processing test using the TESTFN you would have to remember to add the os.getpid call to the actual TESTFN instead of it just being included by default. Ultimately, this is really just extra information that is included in the temporary filenames. It might be worth just closing this issue. -- nosy: +loganasherjones ___ Python tracker <https://bugs.python.org/issue15305> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28002] Some f-strings do not round trip through Tools/parser/test_unparse.py
Logan Jones added the comment: After speaking with Lukasz about this, it seems like the unparser is using the normal unicode repr to determine what should be returned. The default unicode repr will escape quotes if necessary. This is not allowed for f-strings and is the root cause of the problem. One way to solve this is to add a flag to the unicode_repr function to determine whether or not we need to allow triple quotes in the output of the repr. By default this will be false and will use backslashes, but the ast_unparse will use true for this. -- nosy: +loganasherjones ___ Python tracker <https://bugs.python.org/issue28002> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18096] bad library order returned by python-config.in
Logan Chien added the comment: It seems that this is still reproducible with Python 3.5 (dev) by running: $ gcc test.c `python3-config --includes --ldflags` cpython-install/lib/python3.5/config-3.5m/libpython3.5m.a(pytime.o): In function `_PyTime_ObjectToTime_t': cpython-build/../cpython/Python/pytime.c:371: undefined reference to `ceil' cpython-build/../cpython/Python/pytime.c:373: undefined reference to `floor' ... skipped ... I have slightly revised the patch to include Misc/python-config.sh.in as well. Please have a look. Thanks. -- keywords: +patch nosy: +Logan.Chien versions: +Python 3.5 Added file: http://bugs.python.org/file36767/fix-undef-ref.patch ___ Python tracker <http://bugs.python.org/issue18096> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2636] Regexp 2.7 (modifications to current re 2.2.2)
Changes by Joshua Logan : -- nosy: +jaylogan ___ Python tracker <http://bugs.python.org/issue2636> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com