[issue46872] Odd handling of signal raised if an illegal syscall is attempted on Android

2022-02-27 Thread Dan Snider
New submission from Dan Snider : On Android, the following calls generate a SIGSYS signal that is neither blocked by pthread_sigmask(SIG_BLOCK, {SIGSYS}) nor ignored after its handler is set to SIG_IGN: (os.chroot(path)) os.setgid(rgid) os.setuid(ruid) (os.setegid(gid

[issue46791] Allow os.remove to defer to rmdir

2022-02-18 Thread Dan Snider
New submission from Dan Snider : It appears sometime recently-ish that POSIX updated remove to the following: #include int remove(const char *path); If path does not name a directory, remove(path) shall be equivalent to  unlink(path). If path names a directory, remove(path) shall

[issue46752] Introduce task groups to asyncio and change task cancellation semantics

2022-02-16 Thread Dan Halbert
Dan Halbert added the comment: For your TODO list (not sure how else to communicate this): I agree with the de-emphasis of gather(). I think adding another version of gather() that cancels all the remaining tasks if one fails would also be good, unless you think it is completely redundant

[issue46350] re.sub, re.Match.expand, etc doesn't allow x, u, U, or N escapes in the template

2022-01-11 Thread Dan Snider
New submission from Dan Snider : The docs use the phrase "unknown escapes of ASCII letters are reserved for future use and treated as errors". That seems ambiguous enough to question why "\x", "\u", "\U", and "\N{}" escapes aren't expanded in

[issue45913] readline + GTK + Pytest Seg Fault with Python 3.7 and 3.10 on CI

2021-11-28 Thread Dan Yeaw
Dan Yeaw added the comment: I continued to look in to this and updated the title of the issue, I don't think this is caused by doctest. I also updated a minimum example here: https://github.com/danyeaw/plugin-console-test If using pytest and GTK, any module loaded that makes use of readline

[issue45913] Doctest Seg Fault with Python 3.10 on CI

2021-11-27 Thread Dan Yeaw
New submission from Dan Yeaw : When running pytest --doctest-modules, I am getting seg faults on the GitHub Actions CI when running doctests covering module docstrings. runner@fv-az177-300:~/work/gaphor/gaphor$ source .venv/bin/activate (.venv) runner@fv-az177-300:~/work/gaphor/gaphor$ xvfb

[issue21627] Concurrently closing files and iterating over the open files directory is not well specified

2021-09-17 Thread Dan Snider
Dan Snider added the comment: On Android, if os.close_range closes the file descriptor of the scandir iterator, the interpreter immediately crashes eg: >>> import os >>> os.scandir() >>> os.closerange(3,) fdsan: attempted to close file descriptor 3, expec

[issue44664] builtins.chr and the 'c' format flag raise different errors

2021-07-17 Thread Dan Snider
New submission from Dan Snider : chr (or anything else which calls `PyUnicode_FromOrdinal`) raises ValueError if its argument falls outside the range of valid Unicode code points, while `PyUnicode_FromFormat` raises OverflowError. Shouldn't the latter raise ValueError as well

[issue44611] CPython uses deprecated randomness API

2021-07-12 Thread Dan Stromberg
Dan Stromberg added the comment: Yes, cng-portal. On Mon, Jul 12, 2021 at 3:24 PM Thomas Grainger wrote: > > Thomas Grainger added the comment: > > https://docs.microsoft.com/en-us/windows/win32/seccng/cng-portal ? > > --

[issue44611] CPython uses deprecated randomness API

2021-07-12 Thread Dan Stromberg
New submission from Dan Stromberg : CPython 3.9 uses CryptGenRandom(), which has been deprecated by Microsoft. I'm told the randomness produced by CryptGenRandom() is fine, but Microsoft has introduced a newer API for getting randomness. For these reasons, Python/bootstrap_hash.c should

[issue39442] from __future__ import annotations makes dataclasses.Field.type a string, not type

2021-05-21 Thread Dan Cecile
Change by Dan Cecile : -- nosy: +dcecile ___ Python tracker <https://bugs.python.org/issue39442> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43947] lambdas stored with assignment expressions are unoptimized

2021-04-26 Thread Dan Snider
New submission from Dan Snider : >>> import dis >>> @dis.dis ... def funcdef(k): return k in {None} ... 2 0 LOAD_FAST 0 (k) 2 LOAD_CONST

[issue43545] Use LOAD_GLOBAL to set __module__ in class def

2021-03-18 Thread Dan Snider
New submission from Dan Snider : Other than obvious performance implications this has, usage of LOAD_NAME makes defining cls.__name__ from within metaclass.__prepare__ difficult. -- messages: 389026 nosy: bup priority: normal severity: normal status: open title: Use LOAD_GLOBAL to set

[issue43436] bounded _lru_cache_wrapprer behaves as if typed=True when it wasn't

2021-03-08 Thread Dan Snider
New submission from Dan Snider : Isn't the point of setting typed=True to make it so that e.g. True doesn't register as a hit when there is already a cache entry for 1.0? Assuming that is the case, although this report specifically targets 3.8 I found no indication that what I believe

[issue43341] functools.partial missing __weakref__ descriptor?

2021-02-27 Thread Dan Snider
New submission from Dan Snider : The only way to lookup weak references to functools.partial objects is with weakref.getweakrefs. I don't know if it's normal for extension types that define tp_weaklistoffset to not add a __weakref__ descriptor, but I figured at the very least a subtype

[issue41562] StreamReaderProtocol inheritance

2020-11-28 Thread Dan Pascu
Dan Pascu added the comment: While it may not be affected at a functional level (at least not in a way I can see right now), it is confusing when reading that code. Isn't clarity and avoiding confusion a desired trait for core python code? What about all these recommendations from the Zen

[issue42402] Termios module documentation is extremely lacking

2020-11-19 Thread Dan Merillat
Dan Merillat added the comment: Correction, the example source in the documentation is correct as there's no symbolic names for the tty attributes array, only the cc field. -- ___ Python tracker <https://bugs.python.org/issue42

[issue42402] Termios module documentation is extremely lacking

2020-11-18 Thread Dan Merillat
New submission from Dan Merillat : "The interpretation of the flags and the speeds as well as the indexing in the cc array must be done using the symbolic constants defined in the |termios| module." (termios links to itself) These constants are not listed in the doc

[issue42368] Make set ordered

2020-11-16 Thread Dan Gheorghe Haiduc
Dan Gheorghe Haiduc added the comment: rhettinger wrote [1]: > The existing setobject code has been finely tuned and micro-optimized over > the years, giving it excellent performance on workloads we care about. This worries me also. But I suppose the tuning should make itself v

[issue42368] Make set ordered

2020-11-16 Thread Dan Gheorghe Haiduc
Dan Gheorghe Haiduc added the comment: Oops. The reference number [2] in the previous message should instead be https://stackoverflow.com/q/6614447/235463 . -- ___ Python tracker <https://bugs.python.org/issue42

[issue42368] Make set ordered

2020-11-16 Thread Dan Gheorghe Haiduc
New submission from Dan Gheorghe Haiduc : Now that dicts are ordered[1], would it by any chance make sense to also order sets? A use case that I ran into is trying to reproducibly get a random.choice from a set (after calling random.seed). At first I did not need reproducibility, and I

[issue41956] Regression in HTMLParser on malformed tags

2020-10-06 Thread Dan
New submission from Dan : The attached HTML document (pulled from a Samsung printer web interface) contains the following invalid HTML tag: (invalid because of ,="") In Python 3.x completely stops the HTML parser, preventing any further tags from being parsed. This does not happen

[issue41562] StreamReaderProtocol inheritance

2020-08-16 Thread Dan Pascu
New submission from Dan Pascu : I noticed that StreamReaderProtocol is defined like this: class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): ... but FlowControlMixin already inherits protocols.Protocol: class FlowControlMixin(protocols.Protocol): ... It seems

[issue28859] os.path.ismount sometimes raises FileNotFoundError on Windows

2020-02-05 Thread Dan Arad
Change by Dan Arad : -- nosy: +Dan Arad ___ Python tracker <https://bugs.python.org/issue28859> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14149] argparse: Document how to use argument names that are not Python identifiers

2020-02-05 Thread Dan Arad
Dan Arad added the comment: Hi everyone! I thought to take this issue up by updating the documentation. Is this still relevant? If so I think the best place to add the documentation is in the "name or flags" section, where people will go looking first. I think to add both t

[issue39528] add "

2020-02-01 Thread Dan Snider
Change by Dan Snider : -- nosy: bup priority: normal severity: normal status: open title: add " ___ Python tracker <https://bugs.python.org/issue39528> ___ ___

[issue39451] enum.Enum reference count leaks

2020-01-26 Thread Dan Gass
Dan Gass added the comment: Sorry for not thinking of trying this sooner. Running garbage collection, import gc; gc.collect(), releases the resources and restores the expected reference counts. >From my perspective, this is satisfactory and could justify closing this bug >

[issue39451] enum.Enum reference count leaks

2020-01-24 Thread Dan Gass
New submission from Dan Gass : Given (1) instantiation of an enumeration class with an invalid value (2) a try/except around the instantiation where the exception is ignored Then: An unneeded reference to the bad value is lost (as well as other values that I suspect are local variables within

[issue39303] Refactor cmd module

2020-01-11 Thread Dan Arad
New submission from Dan Arad : I've stumbled across the `cmd` module, had some difficulties in reading it, and wanted to help in making it more readable. I'm new to contributing to open source, and thought this could be a good exercise for me, and that if I could contribute along the way

[issue39281] The CO_NESTED flag is associated with a significant performance cost

2020-01-09 Thread Dan Snider
New submission from Dan Snider : The title was carefully worded as I have no idea how or why what is happening is happening, only that it has been like this since a least 3.6.0. That version in particular, by the way, is able to execute a call to a python function with 1 argument 25% faster

[issue33125] Windows 10 ARM64 platform support

2019-11-19 Thread Dan
Dan added the comment: According to this - https://wiki.tcl-lang.org/page/Building+with+Visual+Studio+2017 the issue will be fixed in the next version (8.6.10). TLDR explanation: Tcl/Tk has variables with names that are now reserved keywords in VS2017, meaning that it can't be build

[issue33125] Windows 10 ARM64 platform support

2019-11-15 Thread Dan
Dan added the comment: Steve, the 2.7 build I've posted includes native tk, do you need the necessary patches? -- ___ Python tracker <https://bugs.python.org/issue33

[issue38689] IDLE crashes when KeyError is raised during calltip generation

2019-11-04 Thread Dan Snider
New submission from Dan Snider : When the following program has been input (into 32 bit 3.8.0 Python running on windows 10), all IDLE processes and windows will immediately and irrevocably hang the instant the open parentheses at the end of the statement "Object(" is rendered

[issue38579] 'u' formatted arrays mostly prevent appends of 4 byte characters

2019-10-24 Thread Dan Snider
New submission from Dan Snider : Unicode characters with code points above u+ can only be added to the end of an array, and only from a call to the "fromunicode" method. This is because "fromunicode" uses a different procedure to modify the array compared to __new__,

[issue38446] Ambiguous signature for builtins.__build_class__

2019-10-11 Thread Dan Snider
New submission from Dan Snider : The function has the following signature documented: __build_class__(func, name, *bases, metaclass=None, **kwds) This implies that `func` and `name` are not positional only parameters when in fact, they are. Another problem with that signature

[issue33125] Windows 10 ARM64 platform support

2019-08-29 Thread Dan
Dan added the comment: Hi, I've just noticed this but a couple of months ago I managed to compile Python 2.7 on win32 ARM64 including the said ssl, tk, ctypes modules. You can download from here and test - https://mega.nz/#F!PclhDIRB!-yhBZ6UM7S596ijNU3dx0A You will need to install the MSVC

[issue37367] octal escapes applied inconsistently throughout the interpreter and lib

2019-06-21 Thread Dan Snider
New submission from Dan Snider : At present, the bytecode compiler can generate 512 different unicode characters, one for each integral from the range [0-511), 512 being the total number of syntactically valid permutations of 3 octal digits preceded by a backslash. However, this does

[issue16270] urllib hangs when closing connection

2019-06-10 Thread Dan Hemberger
Change by Dan Hemberger : -- pull_requests: +13820 pull_request: https://github.com/python/cpython/pull/13951 ___ Python tracker <https://bugs.python.org/issue16

[issue37222] urllib missing voidresp breaks CacheFTPHandler

2019-06-10 Thread Dan Hemberger
Change by Dan Hemberger : -- keywords: +patch pull_requests: +13819 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13951 ___ Python tracker <https://bugs.python.org/issu

[issue37222] urllib missing voidresp breaks CacheFTPHandler

2019-06-10 Thread Dan Hemberger
New submission from Dan Hemberger : When using the CacheFTPHandler in the most basic of contexts, a URLError will be thrown if you try to reuse any of the FTP instances stored in the handler. This makes CacheFTPHandler unusable for its intended purpose. Note that the default FTPHandler

[issue37063] Incorrect application of func.__defaults__ by inspect's signature APIs

2019-05-27 Thread Dan Snider
New submission from Dan Snider : The interpreter matches the values in func.__defaults__ with the calculated positional argument names "right-to-left", while inspect does does so "left-to-right". In every day usage, for "normal" functions, generated by the comp

[issue37040] checking for membership in itertools.count enters infinite loop with no way to exit

2019-05-25 Thread Dan Rose
Dan Rose added the comment: Oops you are right. These enter uninterruptible loops too. They are exceptional situations and should do the expected thing - throw exceptions as well. -- ___ Python tracker <https://bugs.python.org/issue37

[issue37040] checking for membership in itertools.count enters infinite loop with no way to exit

2019-05-25 Thread Dan Rose
Dan Rose added the comment: The general problem with infinite iterators is indeed a bigger issue and its resolution would probably resolve this issue too. With the examples you gave at least the user can ctrl-c to interrupt. Entering an infinite, *uninterruptible* loop is a consequence so

[issue37040] checking for membership in itertools.count enters infinite loop with no way to exit

2019-05-25 Thread Dan Rose
Dan Rose added the comment: Reopening. While my behavioral expectation may be wrong, the current behavior is inappropriate. It would make more sense for count to have a `__contains__` method which raises a TypeError. -- resolution: rejected -> status: closed ->

[issue37040] checking for membership in itertools.count enters infinite loop with no way to exit

2019-05-24 Thread Dan Rose
New submission from Dan Rose : Checking membership in `itertools.count()` will either return True in linear time or enter an infinite loop that cannot be terminated with Ctrl-c. This ``` import itertools 1 in itertools.count(0,2) ``` It is expected that the above code will use an efficient

[issue35331] Incorrect __module__ attribute for _struct.Struct and perhaps a few others

2019-05-23 Thread Dan Snider
Change by Dan Snider : -- nosy: -bup ___ Python tracker <https://bugs.python.org/issue35331> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35331] Incorrect __module__ attribute for _struct.Struct and perhaps a few others

2019-05-23 Thread Dan Snider
Change by Dan Snider : -- nosy: +bup ___ Python tracker <https://bugs.python.org/issue35331> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue36956] Calling "functions" used to implement generators/comps easily cause crash

2019-05-18 Thread Dan Snider
New submission from Dan Snider : As far as I know, generators, set comprehensions, list comprehensions, and dict comprehensions, (along with their asynchronous variants) are implemented by first calling the GET_(A)ITER opcode and then building and calling a function that acepts the resulting

[issue36807] IDLE doesn't call os.fsync()

2019-05-12 Thread Dan Halbert
Dan Halbert added the comment: Fix tested and works! Comment from PR duplicated here. I tested this fix by editing the 3.7.3 IDLE code by hand, and editing this test program as code.py on a CIRCUITPY drive on Windows 10: import time i = 0 while True: print(i) i += 1 print

[issue36807] IDLE doesn't call os.fsync()

2019-05-07 Thread Dan Halbert
Dan Halbert added the comment: >Dan, slightly OT, but I am curious whether one can access USB ports (in a >system-dependent manner) directly from python code via os.system and ctypes? Do you mean from CircuitPython? The USB impplementation provides HID keyboard, mouse, and gamepad d

[issue36846] range_iterator does not use __index__

2019-05-07 Thread Dan Snider
New submission from Dan Snider : I wouldn't even know where to begin to try and find a palatable solution for this that wouldn't be summarily dismissed. Perhaps it isn't unreasonable to suggest PyNumber_Index shouldn't use the less stringent PyLong_Check as the entry to the fast path

[issue36807] IDLE doesn't call os.fsync()

2019-05-06 Thread Dan Halbert
Dan Halbert added the comment: I'm one of the CircuitPython core devs. This issue is OS-dependent: Windows and Linux don't necessarily write data and metadata out to USB drives promptly. The problem is particularly acute for FAT12 filesystems on Windows, which are typically 16MB or smaller

[issue36669] weakref proxy doesn't support the matrix multiplication operator

2019-04-19 Thread Dan Snider
Change by Dan Snider : -- nosy: bup priority: normal severity: normal status: open title: weakref proxy doesn't support the matrix multiplication operator ___ Python tracker <https://bugs.python.org/issue36

[issue36626] asyncio run_forever blocks indefinitely

2019-04-17 Thread Dan Timofte
Dan Timofte added the comment: `loop.call_soon_threadsafe(loop.stop)` solves the problem because it has the write_to_self there. I can use that or call loop._write_to_self() myself before calling loop.stop(). In my code i'm stoping the loop from the exception_handler not signal. The code

[issue36626] asyncio run_forever blocks indefinitely

2019-04-15 Thread Dan Timofte
Change by Dan Timofte : -- keywords: +patch pull_requests: +12770 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36626> ___ ___ Py

[issue36626] asyncio run_forever blocks indefinitely

2019-04-14 Thread Dan Timofte
Dan Timofte added the comment: i will provide a patch, i'll make a pull request next week. a call to self._write_to_self() should also be added to create_task() before it returns . i'll make the correction for this as well. -- ___ Python tracker

[issue36626] asyncio run_forever blocks indefinitely

2019-04-14 Thread Dan Timofte
Change by Dan Timofte : -- type: -> behavior ___ Python tracker <https://bugs.python.org/issue36626> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue36626] asyncio run_forever blocks indefinitely

2019-04-13 Thread Dan Timofte
New submission from Dan Timofte : after starting run_forever if all scheduled tasks are consumed run_once will issue a KqueueSelector.select(None) which will block indefinitely : https://www.freebsd.org/cgi/man.cgi?query=select=2=0=FreeBSD+12.0-RELEASE+and+Ports#DESCRIPTION after this new

[issue36617] The rich comparison operators are second class citizens

2019-04-12 Thread Dan Snider
New submission from Dan Snider : The rich comparison operators have an (far as I can tell, unnecessary) limitation compared to the other binary operators, being that the result of an unparenthesized comparison expression cannot be unpacked using the *iterable "unpack" oper

[issue36539] Distutils VC 6.0 Errors When Using mingw-w64 GCC

2019-04-06 Thread Dan Yeaw
Dan Yeaw added the comment: lazka: Thanks for you response. You are correct, the issue was that I had a pip installed version of setuptools somehow. It sounds like you think that all issues should go downstream to fixing them in the MINGW-packages. I am OK with this, it just seams like

[issue36539] Distutils VC 6.0 Errors When Using mingw-w64 GCC

2019-04-05 Thread Dan Yeaw
New submission from Dan Yeaw : I am using the mingw-w64-x86_64-python3 in MSYS2 on Windows to package a PyGObject app. When I try to pip install the app, I am getting errors about the VC 6.0 isn't supported. It looks like setuptools is trying to patch distutils msvc. The msvc9compiler

[issue36283] eval is needlessly limited

2019-03-13 Thread Dan Snider
New submission from Dan Snider : The footnote about why eval/exec cannot be used for arbitrary code has been (for the most part) incorrect for quite some time as the signature for PyEval_EvalCodeEx demonstrates: PyObject* PyEval_EvalCodeEx(PyObject *co, PyObject *globals, PyObject *locals

[issue36045] builtins.help function is not much help with async functions

2019-02-19 Thread Dan Rose
Dan Rose added the comment: Note to future self: whatever solution should also play nice with functools.partial -- ___ Python tracker <https://bugs.python.org/issue36

[issue36045] builtins.help function is not much help with async functions

2019-02-19 Thread Dan Rose
Dan Rose added the comment: Thanks for the suggestion, Raymond. I was toying with the idea of a PR, but wasn’t sure what the resolution should be, and it’s a rather subtle decision for my first contribution. It seems to me that this might be an oversight in PEP-0484, and the purest

[issue36045] builtins.help function is not much help with async functions

2019-02-19 Thread Dan Rose
Change by Dan Rose : -- title: Help function is not much help with async functions -> builtins.help function is not much help with async functions ___ Python tracker <https://bugs.python.org/issu

[issue36045] Help function is not much help with async functions

2019-02-19 Thread Dan Rose
New submission from Dan Rose : It is very important when using a callable to know whether it is async or not. It is expected that `builtins.help` function should provide the information needed to properly use the function, but it omits whether it is an async function or not. ``` import

[issue36000] __debug__ is a keyword but not a keyword

2019-02-15 Thread Dan Snider
New submission from Dan Snider : keyword.py is used by stuff like the idle colorizer to help determine if an identifier is considered a keyword but it doesn't identify __debug__ despite the fact that the parser treats it exactly the same as None, True, and False. I could not find a more

[issue35979] Incorrect __text_signature__ for the __get__ slot wrapper

2019-02-12 Thread Dan Snider
New submission from Dan Snider : The current signature: "__get__($self, instance, owner, /)\n--\n\nReturn an attribute of instance, which is of type owner." doens't match how wrap_descr_get actually parses the arguments to __get__ with: PyArg_UnpackTuple(args

[issue35937] Add instancemethod to types.py

2019-02-07 Thread Dan Snider
New submission from Dan Snider : Having the ability to add binding behavior to any callable is an incredibly useful feature if one knows how to take advantage of it, but unfortunately, nothing that currently (publicly) exists comes close to filling the gap `instancemethod`s secrecy leaves

[issue35714] Document that the null character '\0' terminates a struct format spec

2019-01-10 Thread Dan Snider
New submission from Dan Snider : ie.: >>> from struct import calcsize >>> calcsize('\144\u0064\000xf\U0031000\60d\121\U0051') 16 I'm sure some people think it's obvious or even expect the null character to signal EOF but it probably isn't obvious at al

[issue35196] IDLE text squeezer is too aggressive and is slow

2019-01-02 Thread Dan Snider
Dan Snider added the comment: Not 100% sure if it's appropriate to post this here... so sorry if not. So anyway, the _MAX_COLS and _MAX_LINE constants used for `get_argspec` seem like they were intended to limit the generated text tips to at most 5 rows, 85 characters wide, which makes

[issue5672] Implement a way to change the python process name

2018-12-28 Thread Dan Stromberg
Dan Stromberg added the comment: Isn't this "python script doesn't show up in top correctly" issue a matter of "#!/usr/bin/env python3"? If you "#!/usr/bin/python3" (for example) instead, top seems happy. -- nosy: +strombrg

[issue35390] ctypes not possible to pass NULL c_void_p in structure by reference

2018-12-05 Thread Dan
Change by Dan : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35390> ___ ___ Python-bugs-list mailing list

[issue35390] ctypes not possible to pass NULL c_void_p in structure by reference

2018-12-04 Thread Dan
Dan added the comment: Thank you both, that's really helpful. Yes, I agree eryksun, I was saying that pointers to c_double and other normal pointer objects work fine, but that if you change to void* and c_void_p in my example it doesn't work. The private field seems like a reasonable

[issue35390] ctypes not possible to pass NULL c_void_p in structure by reference

2018-12-03 Thread Dan
New submission from Dan : I have a C struct typedef struct Effect { void* ptr; } Effect; where when I allocate the memory, the void* gets initialized to NULL, and pass back a pointer: Effect* get_effect(){ Effect* pEffect = malloc(sizeof(*pEffect)); pEffect->ptr = N

[issue35331] Incorrect __module__ attribute for _struct.Struct and perhaps a few others

2018-11-27 Thread Dan Snider
New submission from Dan Snider : _struct.Struct not defining a valid __module__ by prefixing its tp_name slot with "_struct" is inconsistent with every other extension type which is available in the corresponding module globals. >From the documentation of the `tp_name` s

[issue35176] for loop range bug

2018-11-06 Thread Dan Armentrout
Dan Armentrout added the comment: Thank you for your quick explanation of this to me. Dan On Tue, Nov 6, 2018 at 8:04 AM Steven D'Aprano wrote: > > Steven D'Aprano added the comment: > > This is not a bug, this is standard behaviour, working as designed. > > 'a' is not

[issue35176] for loop range bug

2018-11-06 Thread Dan Armentrout
New submission from Dan Armentrout : If you run the following code: x=[3,4,5] a=x for i in range(0,len(a)): a[i]=0 All x values are changed to equal a. -- components: Windows messages: 329357 nosy: darmentr, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity

[issue35166] BUILD_MAP_UNPACK doesn't function as expected for dict subclasses

2018-11-04 Thread Dan Snider
New submission from Dan Snider : >>> class Dict(dict): def keys(self): assert 0 def update(*args, **kwds): assert 0 def __getitem__(self, key): assert 0 def __iter__(self): assert 0 >>> {**Dict(a=1)} {'a': 1} The opcode

[issue25410] Clean up and fix OrderedDict

2018-11-04 Thread Dan Snider
Dan Snider added the comment: It might be more appropriate to start a new issue for this, but I'll leave that decision to somehow who would know for sure. Anyway, basically the entire dict/PyDictObject api functions do not appear work at all with OrderedDict. Or rather, OrderedDict doesn't

[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Dan Boxall
Dan Boxall added the comment: Yes I realised that, as I said earlier. But it could say, "Invalid regular expression" and not produce ten lines of error messages. On Fri, 2 Nov 2018 at 14:21, Steven D'Aprano wrote: > > Steven D'Aprano added the comment: > > This

[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Dan Boxall
Dan Boxall added the comment: Thank you. I realised that and if I put a dot in front it worked fine. But it should not break the function, so they will surely want to fix the bug? Kind regards, Dan Boxall On Fri, 2 Nov 2018 at 13:56, Windson Yang wrote: > > Windson Yang added the c

[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Dan Boxall
New submission from Dan Boxall : Hi, I'm new to regular expressions and while playing around with them I tried this: >>> rex = '*New Revision:.* ([0-9]+)' >>> re.findall(rex, text) and got this: Traceback (most recent call last): File "", line 1, in File &

[issue35048] Can't reassign __class__ despite the assigned class having identical slots

2018-10-23 Thread Dan Snider
New submission from Dan Snider : >>> class a(dict): __slots__ = '__dict__', 'x' >>> class b(dict): __slots__ = '__dict__', 'x' >>> self = a(); self.__class__ = b Traceback (most recent call last): File "", line 1, in self=a(); self.__class__ =

[issue34396] Certain methods that heap allocated subtypes inherit suffer a 50-80% performance penalty

2018-10-20 Thread Dan Snider
Dan Snider added the comment: Well, I found another mystery. Calling tuple.__getitem__ directly, on an actual tuple instance, is 50-80% slower than calling list.__getitem__ even though in theory, they should be virtually identical with maybe tuple access being infinitesimally be faster

[issue34924] inspect.signature isn't aware that types.MethodType can wrap any callable

2018-10-07 Thread Dan Snider
New submission from Dan Snider : I actually noticed this due to it confusingly breaking IDLE call tips and code completion. >>> import inspect >>> from types import MethodType >>> bound_len = MethodType(len, 'abc') >>> bound_len() 3 >>> inspect

[issue34887] bytes subclass __repr__ raise SystemError when set to bytes.decode

2018-10-03 Thread Dan Snider
New submission from Dan Snider : I've tested it on at least one of each minor version since 3.4 but it looks like it may be specific to 3.6.0. The developer's guide isn't clear enough for me to understand what's eligible for bug fixes but since I'm not sure if it actually is 3.6.0 exclusive

[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-09-30 Thread Dan Snider
Dan Snider added the comment: So I also just happened to notice that the "documentation is wrong" for list, tuple, and collections.deque. They use use _PyEval_SliceIndexNotNone whch causes this: >>> s = 'abcde' >>> s.index('d', 0, None) 3 >>> [*s].in

[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-09-29 Thread Dan Snider
New submission from Dan Snider : Unfortunately, it looks like there's no requirement for an abc.Sequence to implement the 3 argument form of seq.index, so I suppose this is technically just a documentation bug... >>> range(5).index(2, 1) Traceback (most recent call last): File &

[issue34842] Incorrect error messages in bisect

2018-09-29 Thread Dan Snider
New submission from Dan Snider : internal_bisect_left and internal_bisect_right use PySequence_Size when a "hi" argument wasn't provided, which causes this silly error message: >>> bisect.bisect_right(dict.fromkeys(range(10)), 5) Traceback (most recent call last):

[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

2018-09-21 Thread Dan Snider
Dan Snider added the comment: It's working as intended. locals() and vars() simply returns the current frame's f_locals. In functions, modifying this usually accomplishes nothing useful because the code object has OPTIMIZED and NEWLOCALS flags set, meaning local variables are looked up

[issue34620] Octal byte literals with a decimal value > 255 are silently truncated

2018-09-10 Thread Dan Snider
New submission from Dan Snider : >>> b'\542\571\564\545\563', b'\142\171\164\145\163' (b'bytes', b'bytes') All the C compilers I know of at the very least generate a warning when one tries to assign an oct literal >= '\400' to a byte. And that's because it's nonsense when bytes

[issue34497] Remove needless set operator restriction

2018-08-25 Thread Dan Snider
Change by Dan Snider : -- keywords: +patch pull_requests: +8394 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34497> ___ ___ Python-

[issue34497] Remove needless set operator restriction

2018-08-25 Thread Dan Snider
New submission from Dan Snider : I only just now realized that `dict.fromkeys('abc').keys() - 'bc'` returns {'a'} instead of raising an error like {*'abc'} - 'bc' would, which is really quite handy. The __xor__, __and__, and __sub__ methods of dict_keys (and items, assuming

[issue34396] Certain methods that heap allocated subtypes inherit suffer a 50-80% performance penalty

2018-08-13 Thread Dan Snider
New submission from Dan Snider : The ones I know of are list.__getitem__, dict __contains__ & __getitem__, and (frozen)set.__contains__ but from what I can tell so far it seems like dict.__getitem__ takes the worst hit. For dicts, I've spent a few hours trying to figure out what's get

[issue34314] Like __hash__, allow setting MyClass.__init__ to None to prevent it being called by type.__call__

2018-08-01 Thread Dan Snider
New submission from Dan Snider : Right now, you really gotta jump through hoops in some cases if you only want to use __new__ and don't care about __init__ (is there ever a time where you'd use both?). The problem originates in type.__call__. I'm attaching a full Python implementation

[issue34290] _ctypes PyCField_new doesn't do anything

2018-07-31 Thread Dan Snider
New submission from Dan Snider : The function is essentially nothing more than a prototype at the moment: static PyObject * PyCField_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { CFieldObject *obj; obj = (CFieldObject *)type->tp_alloc(type, 0); return (PyObject *)

[issue34192] FunctionType.__new__ can generate functions that immediately crash

2018-07-22 Thread Dan Snider
New submission from Dan Snider : The following program crashes on 3.3.1, 3.4.2, 3.5.2, and 3.6.1 because despite having a non-empty co_cellvars slot due to the generator object, the NOFREE flag was set. 3.7 isn't immune to some bad behavior here, either. While I only have access to 3.7.03b

[issue34146] PyCData_Type.tp_hash doesn't use PyObject_HashNotImplemented

2018-07-18 Thread Dan Snider
New submission from Dan Snider : So not only does the function it does use (`PyCData_nohash`) prevent PyType_Ready from setting _ctypes._SimpleCData.__dict__["__hash__"] to `None`, (contrary to to every other unhashable type in the standard library) but the error message it retur

[issue34123] ambiguous documentation for dict.popitem

2018-07-16 Thread Dan Snider
New submission from Dan Snider : https://docs.python.org/3/library/stdtypes.html#dict.popitem `dict.popitem` no longer returns an "arbitrary" (key, value) pair as the documentation suggests. Rather, it always returns the pair whose key was most recently *inserted* (ie., the

  1   2   3   4   >