[issue818201] distutils: clean does not use build_base option from build

2011-12-16 Thread Josh
Josh added the comment: Where was this fixed? It is still a problem in Python 2.6.6. For example, if I do: python setup.py build_ext --compiler=mingw32 build --build-platlib=build\win64 Then follow it up with: python setup.py clean --build-base=build\win64 -a This is what it does: running

[issue46082] type casting of bool

2021-12-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Agreed, this is not a bug. The behavior of the bool constructor is not a parser (unlike, say, int), it's a truthiness detector. Non-empty strings are always truthy, by design, so both "True" and "False" are truthy strings. There&

[issue46148] Optimize pathlib

2021-12-22 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note: attrgetter could easily be made faster by migrating it to use vectorcall. -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue46

[issue46175] Zero argument super() does not function properly inside generator expressions

2021-12-27 Thread Josh Rosenberg
Josh Rosenberg added the comment: Carlos: This has nothing to do with reloading (as Alex's repro shows, no reload calls are made). super() *should* behave the same as super(CLASS_DEFINED_IN, self), and it looks like the outer function is doing half of what it must do to make no-arg

[issue46645] Portable python3 shebang for Windows, macOS, and Linux

2022-02-04 Thread Josh Triplett
New submission from Josh Triplett : I'm writing this issue on behalf of the Rust project. The build system for the Rust compiler is a Python 3 script `x.py`, which orchestrates the build process for a user even if they don't already have Rust installed. (For instance, `x.py bui

[issue46645] Portable python3 shebang for Windows, macOS, and Linux

2022-02-04 Thread Josh Triplett
Josh Triplett added the comment: Correction to the above evaluation of `#!/usr/bin/env python3`, based on some retesting on Windows systems: The failure case we encounter reasonably often involves the official Python installer for Windows, but applies specifically in the case of third-party

[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-05-27 Thread Josh Triplett
Josh Triplett added the comment: GRUB's filesystem drivers don't support reading mtime. And no, no form of stat() function exists, f or otherwise. On a related note, without HAVE_STAT, import.c can't import package modules at all, since it uses stat to check in advance for a

[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-05-30 Thread Josh Triplett
Josh Triplett added the comment: Given that GRUB doesn't support writing to filesystems at all, I already have to set Py_DontWriteBytecodeFlag, so disabling .pyc/.pyo entirely would work fine for my use case. -- ___ Python tracker

[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-05-31 Thread Josh Triplett
Josh Triplett added the comment: Rather than checking for a directory, how about just opening foo/__init__.py, and if that fails opening foo.py? -- ___ Python tracker <http://bugs.python.org/issue12

[issue12603] pydoc.synopsis breaks if filesystem returns mtime of 0 (common for filesystems without mtime)

2011-07-21 Thread Josh Triplett
New submission from Josh Triplett : In Python 2.7.2, pydoc.py's synopsis contains this code implementing a cache: mtime = os.stat(filename).st_mtime lastupdate, result = cache.get(filename, (0, None)) if lastupdate < mtime: Many filesystems don't have any concept of m

[issue12604] VTRACE macro in _sre.c should use do {} while (0)

2011-07-21 Thread Josh Triplett
New submission from Josh Triplett : In _sre.c, the VTRACE macro normally gets defined to nothing. It later gets used as the body of control structures such as "else" without braces, which causes many compilers to warn (to catch stray semicolons like "else;"). This m

[issue12603] pydoc.synopsis breaks if filesystem returns mtime of 0

2011-07-22 Thread Josh Triplett
Josh Triplett added the comment: The current behavior of pydoc will cause synopsis to always incorrectly return "None" as the synopsis for any module with mtime == 0. Both of the proposed fixes will fix that bug without affecting any case where mtime != 0, so I don't think

[issue8863] Display Python backtrace on SIGSEGV, SIGFPE and fatal error

2010-10-13 Thread Josh Bressers
Josh Bressers added the comment: You would be wise to avoid using heap storage once you're in the crash handler. From a security standpoint, if something has managed to damage the heap (which is not uncommon in a crash), you should not attempt to allocate or free heap memory. On modern

[issue8863] Display Python backtrace on SIGSEGV, SIGFPE and fatal error

2010-10-13 Thread Josh Bressers
Josh Bressers added the comment: I am then confused by this in the initial comment: > It calls indirectly PyUnicode_EncodeUTF8() and so call > PyBytes_FromStringAndSize() which allocates memory on the heap. I've not studied the patch though, so this may h

[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-05-15 Thread Josh Triplett
New submission from Josh Triplett : Even if pyconfig.h defines DONT_HAVE_STAT and DONT_HAVE_FSTAT (which prevents the definitions of HAVE_STAT and HAVE_FSTAT), Python still references fstat in Python/import.c, along with struct stat and constants like S_IXUSR. I ran into this when attempting

[issue12083] Compile-time option to avoid writing files, including generated bytecode

2011-05-15 Thread Josh Triplett
New submission from Josh Triplett : PEP 304 provides a runtime option to avoid saving generating bytecode files. However, for embedded usage, it would help to have a compile-time option to remove all the file-writing code entirely, hardcoding PYTHONBYTECODEBASE="". I ran into

[issue10837] Issue catching KeyboardInterrupt while reading stdin

2011-01-05 Thread Josh Hanson
New submission from Josh Hanson : Example code: try: sys.stdin.read() except KeyboardInterrupt: print "Interrupted!" except: print "Some other exception?" finally: print "cleaning up..." print "done.&

[issue2475] Popen.poll always returns None

2008-03-24 Thread Josh Cogliati
New submission from Josh Cogliati <[EMAIL PROTECTED]>: I was trying to use subprocess to run multiple processes, and then wait until one was finished. I was using poll() to do this and created the following test case: #BEGIN import subprocess,os procs = [subprocess.Popen(["sleep&qu

[issue2475] Popen.poll always returns None

2008-04-03 Thread Josh Cogliati
Josh Cogliati <[EMAIL PROTECTED]> added the comment: Hm. Well, after filing the bug, I created a thread for each subprocess, and had that thread do an wait on the process, and that worked fine. So, I guess at minimum it sounds like the documentation for poll could be improved to mentio

[issue39812] Avoid daemon threads in concurrent.futures

2022-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: I think this is causing a regression for code that explicitly desires the ThreadPoolExecutor to go away abruptly when all other non-daemon threads complete (by choosing not to use a with statement, and if shutdown is called, calling it with wait=False, or

[issue39812] Avoid daemon threads in concurrent.futures

2022-04-06 Thread Josh Rosenberg
Change by Josh Rosenberg : -- Removed message: https://bugs.python.org/msg416876 ___ Python tracker <https://bugs.python.org/issue39812> ___ ___ Python-bug

[issue37814] typing module: empty tuple syntax is undocumented

2019-08-13 Thread Josh Holland
Change by Josh Holland : -- pull_requests: +14981 pull_request: https://github.com/python/cpython/pull/15262 ___ Python tracker <https://bugs.python.org/issue37

[issue37852] Pickling doesn't work for name-mangled private methods

2019-08-14 Thread Josh Rosenberg
New submission from Josh Rosenberg : Inspired by this Stack Overflow question, where it prevented using multiprocessing.Pool.map with a private method: https://stackoverflow.com/q/57497370/364696 The __name__ of a private method remains the unmangled form, even though only the mangled form

[issue37852] Pickling doesn't work for name-mangled private methods

2019-08-15 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Objects referencing private-mangled names do not roundtrip properly under pickling. ___ Python tracker <https://

[issue33007] Objects referencing private-mangled names do not roundtrip properly under pickling.

2019-08-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: This problem is specific to private methods AFAICT, since they're the only things which have an unmangled __name__ used to pickle them, but are stored as a mangled name. More details on cause and solution on issue #37852, which I closed as a duplica

[issue37872] Move statics in Python/import.c to top of the file

2019-08-16 Thread Josh Rosenberg
Change by Josh Rosenberg : -- title: Move statitics in Python/import.c to top of the file -> Move statics in Python/import.c to top of the file ___ Python tracker <https://bugs.python.org/issu

[issue37976] zip() shadows TypeError raised in __iter__() of source iterable

2019-08-29 Thread Josh Rosenberg
Josh Rosenberg added the comment: Raymond: "Since there isn't much value in reporting which iterable number has failed" Isn't there though? If the error just points to the line with the zip, and the zip is zipping multiple similar things (especially things which won'

[issue23670] Modifications to support iOS as a cross-compilation target

2019-09-03 Thread Josh Rosenberg
Change by Josh Rosenberg : -- title: Restore -> Modifications to support iOS as a cross-compilation target ___ Python tracker <https://bugs.python.org/issu

[issue38046] Can't use sort_keys in json.dumps with mismatched types

2019-09-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is an exact duplicate of #25457. -- nosy: +josh.r resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> json dump fails for mixed-type keys when sort_keys is specified __

[issue38003] Incorrect "fixing" of isinstance tests for basestring

2019-09-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: basestring in Python 2 means "thing that is logically text", because in Python 2, str can mean *either* logical text *or* binary data, and unicode is always logical text. str and unicode can kinda sorta interoperate on Python 2, so it can make sen

[issue38116] Make select module PEP-384 compatible

2019-09-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: Why do you describe these issues (this one, #38069, #38071-#38076, maybe more) as making the module PEP 384 compatible? There is no reason to make the built-in modules stick to the limited API, and it doesn't look like you're doing that in any ev

[issue33214] join method for list and tuple

2019-09-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note that all of Serhiy's examples are for a known, fixed number of things to concatenate/union/merge. str.join's API can be used for that by wrapping the arguments in an anonymous tuple/list, but it's more naturally for a variable number of

[issue38167] O_DIRECT read fails with 4K mmap buffer

2019-09-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: Works just fine for me on 3.7.3 on Ubuntu, reading 4096 bytes. How is it failing for you? Is an exception raised? It does seem faintly dangerous to explicitly use O_DIRECT when you're wrapping it in a buffered reader that doesn't know it has

[issue38241] Pickle with protocol=0 in python 3 does not produce a 'human-readable' format

2019-09-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: This seems like a bug in pickle; protocol 0 is *defined* to be ASCII compatible. Nothing should encode to a byte above 0x7f. It's not actually supposed to be "human-readable" (since many ASCII bytes aren't printable), so the docs

[issue38241] Pickle with protocol=0 in python 3 does not produce a 'human-readable' format

2019-09-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'll note, the same bug appears in Python 2, but only when pickling bytearray; since bytes in Python 2 is just a str alias, you don't see this misbehavior with it, only with bytearray (which is consistently incorrect/non-ASCII on bot

[issue38255] Replace "method" with "attribute" in the description of super()

2019-09-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: I prefer rhettinger's PR to your proposed PR; while super() may be useful for things other than methods, the 99% use case is methods, and deemphasizing that is a bad idea. rhettinger's PR adds a note about other use cases without interfering with

[issue36947] Fix 3.3.3.1 Metaclasses Documentation

2019-09-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: The existing documentation is correct, just hard to understand if you don't already understand the point of metaclasses (metaclasses are hard, the language to describe them will be inherently a little klunky). At some point, it might be nice to wr

[issue38167] O_DIRECT read fails with 4K mmap buffer

2019-10-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: > I do not believe an unbuffered file uses O_DIRECT. This is why I use > os.open(fpath, os.O_DIRECT). Problem is you follow it with: fo = os.fdopen(fd, 'rb+') which introduces a Python level of buffering around the kernel unbuffered

[issue38167] O_DIRECT read fails with 4K mmap buffer

2019-10-10 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yeah, not a bug. The I/O subsystem was substantially rewritten between Python 2 and Python 3, so you sometimes need to be more explicit about things like buffering, but as you note, once the buffering is correct, the code works; there's nothing t

[issue32856] Optimize the `for y in [x]` idiom in comprehensions

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: OOC, rather than optimizing a fairly ugly use case, might another approach be to make walrus less leaky? Even if observable leakage is considered desirable, it strikes me that use cases for walrus in genexprs and comprehensions likely break up into: 1. 90

[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Pablo's fix looks like a superset of the original fix applied here, so I'm assuming it fixes this issue as well. -- nosy: +josh.r ___ Python tracker <https://bugs.python.o

[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: It should probably be backport to all supported 3.x branches though, so people aren't required to move to 3.8 to benefit from it. -- ___ Python tracker <https://bugs.python.org/is

[issue38566] Description of '\w' behavior is vague in `re` documentation

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: The definition of \w, historically, has corresponded to the set of characters that can occur in legal variable names in C (alphanumeric ASCII plus underscores, making it equivalent to [a-zA-Z0-9_] for ASCII regex). That's why, on top of the definitely

[issue38560] Allow iterable argument unpacking after a keyword argument?

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'd be +1 on this, but I'm worried about existing code relying on the functional use case from your example. If we are going to discourage it, I think we either have to: 1. Have DeprecationWarning that turns into a SyntaxError, or 2. Never truly

[issue36906] Compile time textwrap.dedent() equivalent for str or bytes literals

2019-11-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is there a reason folks are supporting a textwrap.dedent-like behavior over the generally cleaner inspect.cleandoc behavior? The main advantage to the latter being that it handles: '''First Second Third '''

[issue38710] unsynchronized write pointer in io.TextIOWrapper in 'r+' mode

2019-11-06 Thread Josh Rosenberg
Change by Josh Rosenberg : -- components: +Library (Lib) ___ Python tracker <https://bugs.python.org/issue38710> ___ ___ Python-bugs-list mailing list Unsub

[issue38710] unsynchronized write pointer in io.TextIOWrapper in 'r+' mode

2019-11-06 Thread Josh Rosenberg
Change by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue38710> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43824] array.array.__deepcopy__() accepts a parameter of any type

2021-04-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: __deepcopy__ is required to take a second argument by the rules of the copy module; the second argument is supposed to be a memo dictionary, but there's no reason to use it for array.array (it can't contain Python objects, and you only us

[issue37355] SSLSocket.read does a GIL round-trip for every 16KB TLS record

2021-04-19 Thread Josh Snyder
Change by Josh Snyder : -- keywords: +patch pull_requests: +24203 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25478 ___ Python tracker <https://bugs.python.org/issu

[issue44175] What do "cased" and "uncased" mean?

2021-05-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: "Cased": Characters which are either lowercase or uppercase (they have some other equivalent form in a different case) "Uncased": Characters which are neither uppercase nor lowercase. Do you have a suggested alternate wording?

[issue44175] What do "cased" and "uncased" mean?

2021-05-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: See the docs for the title method on what they mean by "titlecased"; "a" is self-evidently not titlecased. https://docs.python.org/3/library/stdtypes.html#str.title -- ___ Python tracker <

[issue44389] Modules/_ssl.c, repeated 'SSL_OP_NO_TLSv1_2'

2021-06-16 Thread Josh Jiang
Change by Josh Jiang : -- nosy: +johnj nosy_count: 5.0 -> 6.0 pull_requests: +25339 pull_request: https://github.com/python/cpython/pull/26754 ___ Python tracker <https://bugs.python.org/issu

[issue44318] Asyncio classes missing __slots__

2021-06-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Andrei: The size of an instance of Semaphore is 48 bytes + 104 more bytes for the __dict__ containing its three attributes (ignoring the cost of the attributes themselves). A slotted class with three attributes only needs 56 bytes of overhead per-instance

[issue14995] PyLong_FromString documentation should state that the string must be null-terminated

2021-06-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: The description is nonsensical as is; not sure the patch goes far enough. C-style strings are *defined* to end at the NUL terminator; if it really needs a NUL after the int, saying it "points to the first character which follows the representation o

[issue44470] 3.11 docs.python.org in Polish not English?

2021-06-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: I just visited the link, and it's now *mostly* English, but with random bits of Korean in it (mostly in links and section headers). The first warning block for instance begins: 경고: The parser module is deprecated... Then a few paragraphs later I&#

[issue44140] WeakKeyDictionary should support lookup by id instead of hash

2021-06-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Andrei: If designed appropriately, a weakref callback attached to the actual object would delete the associated ID from the dictionary when the object was being deleted to avoid that problem. That's basically how WeakKeyDictionary works already; it do

[issue44547] fraction.Fraction does not implement __int__.

2021-07-01 Thread Josh Rosenberg
Josh Rosenberg added the comment: Seems like an equally reasonable solution would be to make class's with __trunc__ but not __int__ automatically generate a __int__ in terms of __trunc__ (similar to __str__ using __repr__ when the latter is defined but not the former). The inconsisten

[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2021-07-21 Thread Josh Meranda
Josh Meranda added the comment: I agree with Bigbird and paul.j3. > But I think this is a real bug in argparse, not a documentation problem. > Off hand I can't think of clean way of refining the description without > getting overly technical about the error handling. I

[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2021-07-22 Thread Josh Meranda
Change by Josh Meranda : -- pull_requests: +25838 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27295 ___ Python tracker <https://bugs.python.org/issu

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-07-28 Thread Josh Haberman
Josh Haberman added the comment: I know this is quite an old bug that was closed almost 10 years ago. But I am wishing this had been accepted; it would have been quite useful for my case. I'm working on a new iteration of the protobuf extension for Python. At runtime we create

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-08-02 Thread Josh Haberman
Josh Haberman added the comment: > You can also call (PyObject_Call*) the metaclass with (name, bases, > namespace); But won't that just call my metaclass's tp_new? I'm trying to do this from my metaclass's tp_new, so I can customize the class creation process. Th

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-14 Thread Josh Haberman
Josh Haberman added the comment: I found a way to use metaclasses with the limited API. I found that I can access PyType_Type.tp_new by creating a heap type derived from PyType_Type: static PyType_Slot dummy_slots[] = { {0, NULL} }; static PyType_Spec dummy_spec

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Josh Haberman
Josh Haberman added the comment: > Passing the metaclass as a slot seems like the right idea for this API, > though I recall there being some concern about the API (IIRC, mixing function > pointers and data pointers doesn't work on some platforms?) PyType_Slot is defined as

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Josh Haberman
Josh Haberman added the comment: > It's better to pass the metaclass as a function argument, as with bases. I'd > prefer adding a new function that using a slot. Bases are available both as a slot (Py_tp_bases) and as an argument (PyType_FromSpecWithBases). I don't s

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-27 Thread Josh Haberman
Josh Haberman added the comment: > I consider Py_tp_bases to be a mistake: it's an extra way of doing things > that doesn't add any extra functionality I think it does add one extra bit of functionality: Py_tp_bases allows the bases to be retrieved with PyType_GetSlot().

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-27 Thread Josh Haberman
Josh Haberman added the comment: > "static" anything in C is completely irrelevant to how symbols are looked up > and resolved between modules That is not true. On ELF/Mach-O the "static" storage-class specifier in C will prevent a symbol from being added to the d

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-27 Thread Josh Haberman
Josh Haberman added the comment: > On ELF/Mach-O... nvm, I just realized that you were speaking about Windows specifically here. I believe you that on Windows "static" makes no difference in this case. The second point stands: if you consider LoadLibrary()/dlopen() to be

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-27 Thread Josh Haberman
Josh Haberman added the comment: This behavior is covered by the standard. The following C translation unit is valid according to C99: struct PyTypeObject; extern struct PyTypeObject Foo_Type; struct PyTypeObject *ptr = &Foo_Type; Specifically, &Foo_Type is an "address

[issue45306] Docs are incorrect re: constant initialization in the C99 standard

2021-09-27 Thread Josh Haberman
New submission from Josh Haberman : I believe the following excerpt from the docs is incorrect (https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_base): > Slot initialization is subject to the rules of initializing > globals. C99 requires the initializers to be “a

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-27 Thread Josh Haberman
Josh Haberman added the comment: > Windows/MSVC defines DLLs as separate programs, with their own lifetime and > entry point (e.g. you can reload a DLL multiple times and it will be > reinitialised each time). All of this is true of so's in ELF also. It doesn&#

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-28 Thread Josh Haberman
Josh Haberman added the comment: > Everything is copied by `_FromSpec` after all. One thing I noticed isn't copied is the string pointed to by tp_name: https://github.com/python/cpython/blob/0c50b8c0b8274d54d6b71ed7bd21057d3642f138/Objects/typeobject.c#L3427 This isn't an iss

[issue45333] += operator and accessors bug?

2021-09-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: This has nothing to do with properties, it's 100% about using augmented assignment with numpy arrays and mixed types. An equivalent reproducer is: a = np.array([1,2,3]) # Implicitly of dtype np.int64 a += 0.5 # Throws the same error, no prope

[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target

2021-09-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Aaron: Your understanding of how LEGB works in Python is a little off. Locals are locals for the *entire* scope of the function, bound or unbound; deleting them means they hold nothing (they're unbound) but del can't actually stop them from be

[issue45414] pathlib.Path.parents negative indexing is wrong for absolute paths

2021-10-08 Thread Josh Rosenberg
New submission from Josh Rosenberg : At least on PosixPath (not currently able to try on Windows to check WindowsPath, but from a quick code check I think it'll behave the same way), the negative indexing added in #21041 is implemented incorrectly for absolute paths. Passing either -1

[issue21041] pathlib.PurePath.parents rejects negative indexes

2021-10-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Negative indexing is broken for absolute paths, see #45414. -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue21

[issue45340] Lazily create dictionaries for plain Python objects

2021-10-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Hmm... Key-sharing dictionaries were accepted largely without question because they didn't harm code that broke them (said code gained nothing, but lost nothing either), and provided a significant benefit. Specifically: 1. They imposed no penalty on

[issue45340] Lazily create dictionaries for plain Python objects

2021-10-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Hmm... And there's one other issue (that wouldn't affect people until they actually start worrying about memory overhead). Right now, if you want to determine the overhead of an instance, the options are: 1. Has __dict__: sys.getsizeof(obj) + sys

[issue45414] pathlib.Path.parents negative indexing is wrong for absolute paths

2021-10-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: "We'll definitely want to make sure that we're careful about bad indices ... since it would be easy to get weird behavior where too-large negative indexes start 'wrapping around'" When I noticed the problem, I originally thought

[issue45414] pathlib.Path.parents negative indexing is wrong for absolute paths

2021-10-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: On the subject of sleep-deprived and/or sloppy, just realized: return self.__getitem__(len(self) + idx) should really just be: idx += len(self) no need to recurse. -- ___ Python tracker <ht

[issue45450] Improve syntax error for parenthesized arguments

2021-10-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Why not "lambda parameters cannot be parenthesized" (optionally "lambda function")? def-ed function parameters are parenthesized, so just saying "Function parameters cannot be parenthesized" seems very we

[issue45520] Frozen dataclass deep copy doesn't work with __slots__

2021-10-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: When I define this with the new-in-3.10 slots=True argument to dataclass rather than manually defining __slots__ it works just fine. Looks like the pickle format changes rather dramatically to accommodate it. >>> @dataclass(frozen=True, s

[issue45520] Frozen dataclass deep copy doesn't work with __slots__

2021-10-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: You're right that in non-dataclass scenarios, you'd just use __slots__. The slots=True thing was necessary for any case where any of the dataclass's attributes have default values (my_int: int = 0), or are defined with fields (my_lis

[issue45707] Variable reassginment triggers incorrect behaviors of locals()

2021-11-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is a documented feature of locals() (it's definitionally impossible to auto-vivify *real* locals, because real locals are statically assigned to specific indices in a fixed size array at function compile time, and the locals() function is return

[issue38853] set.repr breaches docstring contract

2019-11-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: To be clear, the docstring is explicitly disclaiming any ordering contract. If you're reading "unordered" as meaning "not reordered" (like a list or tuple, where the elements appear in insertion order), that's not what &qu

[issue38874] asyncio.Queue: putting items out of order when it is full

2019-11-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: The items that haven't finished the put aren't actually "in" the queue yet, so I don't see how non-FIFO order of insertion violates any FIFO guarantees for the contents of the queue; until the items are actually "in", they

[issue38874] asyncio.Queue: putting items out of order when it is full

2019-11-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yes, five outstanding blocked puts can be bypassed by a put that comes in immediately after a get creates space. But this isn't really a problem; there are no guarantees on what order puts are executed in, only a guarantee that once a put succeeds,

[issue38934] Dictionaries of dictionaries behave incorrectly when created from dict.fromkeys()

2019-11-27 Thread Josh Rosenberg
Josh Rosenberg added the comment: That's the expected behavior, and it's clearly documented here: https://docs.python.org/3/library/stdtypes.html#dict.fromkeys Quote: "All of the values refer to just a single instance, so it generally doesn’t make sense for value to be a muta

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Any reason not to just defer opening the file until after the codec has been validated, so the resource acquisition comes last? -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue38

[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2019-12-27 Thread Josh Holland
Change by Josh Holland : -- nosy: +anowlcalledjosh ___ Python tracker <https://bugs.python.org/issue39090> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39167] argparse boolean type bug

2019-12-30 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> ArgumentParser should support bool type according to truth values ___ Python tracker <https://bugs.python

[issue36051] Drop the GIL during large bytes.join operations?

2019-12-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: This will introduce a risk of data races that didn't previously exist. If you do: ba1 = bytearray(b'\x00') * 5 ba2 = bytearray(b'\x00') * 5 ... pass references to thread that mutates them ... ba3 = b

[issue34480] _markupbase.py fails with UnboundLocalError on invalid keyword in marked section

2020-01-04 Thread Josh Kamdjou
Change by Josh Kamdjou : -- keywords: +patch pull_requests: +17250 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/17643 ___ Python tracker <https://bugs.python.org/issu

[issue34480] _markupbase.py fails with UnboundLocalError on invalid keyword in marked section

2020-01-04 Thread Josh Kamdjou
Josh Kamdjou added the comment: (Author of PR https://github.com/python/cpython/pull/17643) Since the behavior of self.error() is determined by the subclass implementation, an Exception is not guaranteed. How should this be handled? It seems the options are: - continue execution, in which

[issue26495] super() does not work in nested functions, genexps, listcomps, and gives misleading exceptions

2020-01-09 Thread Josh Lee
Change by Josh Lee : -- nosy: +jleedev ___ Python tracker <https://bugs.python.org/issue26495> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39693] tarfile's extractfile documentation is misleading

2020-02-19 Thread Josh Rosenberg
New submission from Josh Rosenberg : The documentation for extractfile ( https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractfile ) says: "Extract a member from the archive as a file object. member may be a filename or a TarInfo object. If member is a regular file

[issue36144] Dictionary union. (PEP 584)

2020-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: What is ChainMap going to do? Normally, the left-most argument to ChainMap is the "top level" dict, but in a regular union scenario, last value wins. Seems like layering the right hand side's dict on top of the left hand side's wo

[issue36144] Dictionary union. (PEP 584)

2020-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Sorry, I think I need examples to grok this in the general case. ChainMap unioned with dict makes sense to me (it's equivalent to update or copy-and-update on the top level dict in the ChainMap). But ChainMap unioned with another ChainMap is less

[issue40201] Last digit count error

2020-04-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: Your script is using "true" division with / , (that produces potentially inaccurate float results) not floor division with // , (which gets int results). When the inputs vastly exceed the integer representational capabilities of floats (52-53 bits

[issue40269] Inconsistent complex behavior with (-1j)

2020-04-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: The final entry is identical to the second to last, because ints have no concept of -0. If you used a float literal, it would match the first two: >>> -0.-1j (-0-1j) I suspect the behavior here is due to -1j not actually being a literal on its

[issue42454] Move slice creation to the compiler for constants

2020-11-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yep, Mark Shannon's solution of contextual hashing is what I was trying (without success) when my last computer died (without backing up work offsite, oops) and I gave up on this for a while. And Batuhan Taskaya's note about compiler dictionari

  1   2   3   4   5   6   7   8   9   >