Serhiy Storchaka added the comment:
New changeset 4057e8f9b56789223a1e691d7601003aceb84ad1 by Serhiy Storchaka in
branch '3.7':
[3.7] bpo-40126: Fix reverting multiple patches in unittest.mock. (GH-19351)
(GH-19484)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
New changeset ee249d798ba08f065efbf4f450880a446c6ca49d by Serhiy Storchaka in
branch '3.8':
[3.8] bpo-40126: Fix reverting multiple patches in unittest.mock. (GH-19351)
(GH-19483)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
3.5 and 3.6 are in security fixes only mode, and this issue is not a security
issue. After merging PR 19484 I cannot reproduce the original issue anymore.
I left this issue open for the case if I find a way to write tests for the
merged changes
Serhiy Storchaka added the comment:
New changeset 8f87eefe7f0576c05c488874eb9601a7a87c7312 by Serhiy Storchaka in
branch 'master':
bpo-39943: Add the const qualifier to pointers on non-mutable PyBytes data.
(GH-19472)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
It is a known issue, but I have no references to previous discussions.
Outputting numbers with decimal point will not help in case of complex(-0.0,
1.0). Maybe the only way to solve this problem is to implement special
Imaginary type (as a subclass of
Serhiy Storchaka added the comment:
I tested the following example:
import ipaddress, mmap
x: ipaddress.IPv4Network[int]
y: mmap.mmap[int]
MyPy produces errors:
t.py:4: error: "IPv4Network" expects no type arguments, but 1 given
t.py:5: error: "mmap" expects no type ar
Serhiy Storchaka added the comment:
The Imaginary type could help to solve other "gotchas". For example, in Python
>>> complex(0, float('inf')) * 1
(nan+infj)
But in C++ you will get the real component 0, because multiplication of complex
and real numbers
Serhiy Storchaka added the comment:
How would you work with a file in the "~" directory?
Python is a programming language. It provides you builtin blocks which you can
combine to get the desired behavior. If you what "~" at the start of the path
be expanded to your home
Serhiy Storchaka added the comment:
No, I did not check other changes. These two just looked too suspicious.
--
___
Python tracker
<https://bugs.python.org/issue39
Serhiy Storchaka added the comment:
Yes, of course. And if it overrides some methods, but do not specify doctrings
for new methods, they will be inherited from the parent class.
class A:
"""Base class"""
def foo(self): """Some docst
Serhiy Storchaka added the comment:
Yes, it is a consequence of PR 19345. But it looks like a compiler bug. It
complains about implicit conversion from `const void **` to `void *` in
memcpy() and PyMem_Del().
--
___
Python tracker
<ht
Serhiy Storchaka added the comment:
Do you want to provide a pull request?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
Seconded.
And I wish to add the getrandbytes() method.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
I do not want to open an issue if I know that the idea will be rejected.
--
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
It is not a leak. It is expected behavior when you call
gc.set_debug(gc.DEBUG_SAVEALL).
--
nosy: +serhiy.storchaka
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracke
Serhiy Storchaka added the comment:
Maybe randbytes()?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue40286>
___
___
Python-bug
Serhiy Storchaka added the comment:
All Random methods give the same result independently of endianess and bitness
of the platform.
> I don't think that these two implementations give the same result on big and
> little endian.
The seco
Serhiy Storchaka added the comment:
New changeset fbf2786c4c89430e2067016603078cf3500cfe94 by Serhiy Storchaka in
branch 'master':
bpo-40257: Output object's own docstring in pydoc (GH-19479)
https://github.com/python/cpython/commit/fbf2786c4c89430e206701660
Change by Serhiy Storchaka :
--
pull_requests: +18892
pull_request: https://github.com/python/cpython/pull/19546
___
Python tracker
<https://bugs.python.org/issue40
New submission from Serhiy Storchaka :
>>> help(list[int])
Traceback (most recent call last):
File "", line 1, in
File "/home/serhiy/py/cpython/Lib/_sitebuiltins.py", line 103, in __call__
return pydoc.help(*args, **kwds)
File "/home/serhiy/py/cp
Serhiy Storchaka added the comment:
Did you try to run the tested function in the interactive Python interpreter?
Did you get what you expected?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
The problem is that isinstance(list[int], type) returns True, but list[int] is
not actually an instance of type.
>>> isinstance(list[int], type)
True
>>> issubclass(type(list[int]), type)
False
>>> type.__subclasses__(list[int])
Serhiy Storchaka added the comment:
It is not a bug. Tuple is a callable, but calling it raises a TypeError with
the informative error message.
It does not differ from e.g.
>>> def foo():
... raise TypeError("don't call foo()")
...
>>> callable(fo
Serhiy Storchaka added the comment:
The former implementation was wrong. See issue25054 which contains more obvious
examples of that bug:
>>> re.sub(r"\b|:+", "-", "a::bc")
'-a-:-bc-'
Not all colons were replaced desp
Serhiy Storchaka added the comment:
If the behavior is obviously wrong (like in issue25054), we can fix it without
warnings, and even backport the fix to older versions, because we do not expect
that anybody depends on such weird behavior. If we are going to change the
behavior, but expect
Serhiy Storchaka added the comment:
If add such option to zipfile.is_zipfile(), why not add it to other functions?
There are many tens or hundreds of functions and methods in the stdlib which
accept a file path. Adding such option to all of them is not practical. And
zipfile.is_zipfile
Change by Serhiy Storchaka :
--
pull_requests: +18914
pull_request: https://github.com/python/cpython/pull/19574
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
New changeset 223221b290db00ca1042c77103efcbc072f29c90 by Serhiy Storchaka in
branch 'master':
bpo-40286: Makes simpler the relation between randbytes() and getrandbits()
(GH-19574)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
The stack size is correct. The unreachable code is left because some code (in
particularly the lineno setter of the frame object) depends on instructions
which may be in the unreachable code to determines the boundaries of
programming blocks. It is safer
Serhiy Storchaka added the comment:
I am not sure it would help you. There are legitimate files which contain a
payload followed by the ZIP archive (self-extracting archives, programs with
embedded ZIP archives). And the malware can make the offset of the ZIP archive
be zero.
If you want
Serhiy Storchaka added the comment:
Just check the first 4 bytes of the file. In "normal" ZIP archive they are
b'PK\3\4' (or b'PK\5\6' if it is empty). It is so reliable as checking the
offset, and more efficient. It is even more reliable, because a malware can
Serhiy Storchaka added the comment:
New changeset 7e64414f57b70dc5bc0ab19a3162a0735f9bfabf by Serhiy Storchaka in
branch 'master':
bpo-40257: Improve help for the typing module (GH-19546)
https://github.com/python/cpython/commit/7e64414f57b70dc5bc0ab19a3162a0
Serhiy Storchaka added the comment:
Some work is still needed for HTML output. But this code is so different from
the code for plain text output and so complicated that I was afraid to break
something. I'll rewrite it in separate issue.
--
resolution: -> fixed
stage: patc
Serhiy Storchaka added the comment:
New changeset 12446e6a605f066d837d3a595d0a73e4f3b43b65 by Serhiy Storchaka in
branch 'master':
bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364)
https://github.com/python/cpython/commit/12446e6a605f066d837d3a595d0a73
Change by Serhiy Storchaka :
--
pull_requests: +18920
pull_request: https://github.com/python/cpython/pull/19583
___
Python tracker
<https://bugs.python.org/issue40
Change by Serhiy Storchaka :
--
pull_requests: +18921
pull_request: https://github.com/python/cpython/pull/19584
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
New changeset bfda4db0d2c05eef4e4ae90d899d0b67cb2e33e5 by Serhiy Storchaka in
branch '3.8':
[3.8] bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364)
(GH-19583)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
New changeset 67ae454da749a7ca67115b43205d9fe98bea3213 by Serhiy Storchaka in
branch '3.7':
[3.7] bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364)
(GH-19584)
https://github.com/python/cpyt
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
New changeset 2b5603140c09766a7d4e8243a70d7144f684f6f9 by Serhiy Storchaka in
branch 'master':
bpo-40178: Convert the remaining os functions to Argument Clinic. (GH-19360)
https://github.com/python/cpython/commit/2b5603140c09766a7d4e8243a70d71
Change by Serhiy Storchaka :
--
pull_requests: +18924
pull_request: https://github.com/python/cpython/pull/19587
___
Python tracker
<https://bugs.python.org/issue35
Serhiy Storchaka added the comment:
Yes, it is.
--
nosy: +serhiy.storchaka
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
nosy: +serhiy.storchaka
nosy_count: 3.0 -> 4.0
pull_requests: +18927
pull_request: https://github.com/python/cpython/pull/19593
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
pull_requests: +18928
pull_request: https://github.com/python/cpython/pull/19593
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
I tried to make repr of floats producing a string which rounds up with eval()
(see PR 19593).
>>> complex(0.0, 1.0)
1j
>>> complex(0.0, -1.0)
(0-1j)
>>> complex(-0.0, 1.0)
-(0-1j)
>>> complex(-0.0, -1.0)
(-0.0-1j)
>
Change by Serhiy Storchaka :
--
pull_requests: -18927
___
Python tracker
<https://bugs.python.org/issue22548>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
+1 for splitting test.support on several submodules!
Some imports can also be lazy.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
asyncio is now imported in unittest. Removing direct import from test.support
does not help.
--
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
logging is also imported in unittest and indirectly in asyncio.
--
___
Python tracker
<https://bugs.python.org/issue40
Change by Serhiy Storchaka :
--
pull_requests: +18936
pull_request: https://github.com/python/cpython/pull/19600
___
Python tracker
<https://bugs.python.org/issue40
Change by Serhiy Storchaka :
--
pull_requests: +18937
pull_request: https://github.com/python/cpython/pull/19601
___
Python tracker
<https://bugs.python.org/issue40
Change by Serhiy Storchaka :
--
pull_requests: +18939
pull_request: https://github.com/python/cpython/pull/19603
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
These three PRs combined reduce the number of imported modules from 179 to 105
(not including 24 modules imported by the bare interpreter) and reduce the hot
import time from 160 ms to 80 ms.
--
___
Python
Change by Serhiy Storchaka :
--
components: +Demos and Tools
nosy: +hyeshik.chang, serhiy.storchaka
versions: +Python 3.9
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
It is all correct. Note that set is unordered, so "element #0" can be 1, and
can be "one". If it is 1, you get a type error. If it is "one", which is a
sequence with length 3, you get a value error.
--
nosy: +serhiy.s
Serhiy Storchaka added the comment:
I used -X importtime.
Your benchmark measures the performance of look up in sys.modules.
--
___
Python tracker
<https://bugs.python.org/issue40
Change by Serhiy Storchaka :
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue40335>
___
___
Python-bugs-list mailing list
Unsub
Serhiy Storchaka added the comment:
Reducing the import time is not a goal, it is just a measurable side effect.
The goal is to reduce the number of imported modules unneeded for the
particular test. Importing every module can have side effects which affects the
tested behavior. It would be
Serhiy Storchaka added the comment:
I concur with Mark. It is just an example. The regular expression which would
support all possible forms of numbers (including exponent, underscores,
non-decimal numbers) would be more complex and would distract from the main
goal of the example
New submission from Serhiy Storchaka :
The proposed PR refactors the implementation of typing._SpecialForm.
Different special forms are different by name, docstring, and the behavior of
__getitem__. Instead of special casing by name in __getitem__, instances are
now parametrized by the
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +18950
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/19620
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
I afraid that this is a part of the larger issue (see also issue31165). Seems
the cause is that the GIL can be released when allocate or reallocate the
memory. Does your project use some memory managing hooks?
Using sys.modules.copy().items() can help a
Serhiy Storchaka added the comment:
col_offset = 0 is the correct value. There was a bug which is fixed now (see
issue39474).
--
nosy: +serhiy.storchaka
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Pytho
Serhiy Storchaka added the comment:
$ ./python -m timeit -s 'import random' 'random.randbytes(10**6)'
200 loops, best of 5: 1.36 msec per loop
$ ./python -m timeit -s 'import random'
'random.getrandbits(10**6*8).to_bytes(10**6, "little")'
5
Change by Serhiy Storchaka :
--
nosy: +vinay.sajip
___
Python tracker
<https://bugs.python.org/issue40352>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
It may be time to start emitting a warning if a Random subclass overrides
random() but not getrandbits() or vice versa.
If you only override random(), methods which rely on generating random integers
will use worse algorithm (slightly less uniform). If
Serhiy Storchaka added the comment:
It would be better to implement it as a separate function.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
Also you can just get a ready implementation from more-tertools.
--
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
If sending log messages is not guaranteed, we could use UDP. But when we use
TCP it is expected that log messages will not be lost.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.
Serhiy Storchaka added the comment:
I have doubts that GenericAlias instances are created in mass in tight loops.
Do you have any realistic example which would benefit from speeding up creation
of GenericAlias instances?
--
nosy: +serhiy.storchaka
Serhiy Storchaka added the comment:
And how much faster has your example become?
--
___
Python tracker
<https://bugs.python.org/issue40369>
___
___
Python-bug
Serhiy Storchaka added the comment:
I do not think it is right. Please wait, I'll submit an alternate solution.
--
___
Python tracker
<https://bugs.python.org/is
Serhiy Storchaka added the comment:
$ make -s regen-all
./Include/opcode.h.new regenerated from ./Lib/opcode.py
Jump table written into ./Python/opcode_targets.h.new
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
Serhiy Storchaka added the comment:
New changeset 40ded947f82683f0ed08144599a83d3a1ce719eb by Serhiy Storchaka in
branch 'master':
bpo-40336: Refactor typing._SpecialForm (GH-19620)
https://github.com/python/cpython/commit/40ded947f82683f0ed08144599a83d
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
It does not work with python3.8 either.
$ make -s regen-all PYTHON_FOR_REGEN=python3.8
./Include/opcode.h.new regenerated from ./Lib/opcode.py
Jump table written into ./Python/opcode_targets.h.new
Traceback (most recent call last):
File "/us
Change by Serhiy Storchaka :
--
nosy: +ned.deily, ronaldoussoren
___
Python tracker
<https://bugs.python.org/issue40381>
___
___
Python-bugs-list mailin
Serhiy Storchaka added the comment:
It is not a bug. Execution includes more stages than ast.parse().
--
nosy: +serhiy.storchaka
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bug
Serhiy Storchaka added the comment:
Compilation includes the following stages:
1. Tokenizing.
2. Creating CST (concrete syntax tree).
3. Creating AST (abstract syntax tree).
4. Optimizing AST.
5. Building symtable.
6. Generating bytecode.
7. Optimizing bytecode.
ast.parse() only includes
Serhiy Storchaka added the comment:
New changeset 3c8a5b459d68b4337776ada1e04f5b33f90a2275 by Serhiy Storchaka in
branch 'master':
bpo-40275: Avoid importing asyncio in test.support (GH-19600)
https://github.com/python/cpython/commit/3c8a5b459d68b4337776ada1e04f5b
Serhiy Storchaka added the comment:
New changeset 16994912c93e8e5db7365d48b75d67d3f70dd7b2 by Serhiy Storchaka in
branch 'master':
bpo-40275: Avoid importing socket in test.support (GH-19603)
https://github.com/python/cpython/commit/16994912c93e8e5db7365d48b75d67
Serhiy Storchaka added the comment:
New changeset 515fce4fc4bb0d2db97b17df275cf90640017f56 by Serhiy Storchaka in
branch 'master':
bpo-40275: Avoid importing logging in test.support (GH-19601)
https://github.com/python/cpython/commit/515fce4fc4bb0d2db97b17df275cf9
Change by Serhiy Storchaka :
--
pull_requests: +19033
pull_request: https://github.com/python/cpython/pull/19711
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
I think it is rather a work for linter's and static type checking. Runtime
check adds an overhead, and it is expected that in correct program it will
always pass. You need the check only while write the program, it may help in
debugging. But once i
New submission from Serhiy Storchaka :
Currently typing functions get_origin(), get_args() and get_type_hints() do not
support GenericAlias.
>>> from typing import *
>>> get_origin(List[int])
>>> get_origin(list[int])
>>> get_args(List[int])
(,)
>>&g
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +19039
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/19718
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
typing._GenericAlias represents two different types: user defined (like
List[int]) and special (like List). They have different behavior, and common
methods contain special cases.
The proposed PR rewrites the implementation in more object-oriented
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +19040
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/19719
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
>>> from typing import *
>>> get_args(Callable)
Traceback (most recent call last):
File "", line 1, in
File "/home/serhiy/py/cpython/Lib/typing.py", line 1412, in get_args
if get_origin(tp) is collections.a
Serhiy Storchaka added the comment:
New changeset 68b352a6982f51e19bf9b9f4ae61b34f5864d131 by Serhiy Storchaka in
branch 'master':
bpo-40396: Support GenericAlias in the typing functions. (GH-19718)
https://github.com/python/cpython/commit/68b352a6982f51e19bf9b9f4ae61b3
Serhiy Storchaka added the comment:
get_args(List) == (T,)
--
___
Python tracker
<https://bugs.python.org/issue40398>
___
___
Python-bugs-list mailing list
Unsub
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +19042
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/19720
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
New changeset 6292be7adf247589bbf03524f8883cb4cb61f3e9 by Serhiy Storchaka in
branch 'master':
bpo-40398: Fix typing.get_args() for special generic aliases. (GH-19720)
https://github.com/python/cpython/commit/6292be7adf247589bbf03524f8883c
New submission from Serhiy Storchaka :
While trying to replace typing._GenericAlias with GenericAlias I have found
that the latter does not support nested type variables.
>>> from typing import *
>>> T = TypeVar('T')
>>> X = List[List[T]]
>>>
Serhiy Storchaka added the comment:
The parser generator imports modules token and tokenize. It is not correct,
because they are relevant to the Python version used to run the parser
generator, and not to the Python version for which the parser is generated. It
works currently only because
Serhiy Storchaka added the comment:
On which platform and Python version they were mapped to keyboard number
buttons?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
Not yet. If you don't prefer to fix it yourself, I'll do it as soon as I have
time.
--
___
Python tracker
<https://bugs.python.o
Serhiy Storchaka added the comment:
> It's no different from other edge cases where for some reason the space seems
> optional, like `1and 2`.
The parser is not consistent here. `0or[]` is an error, while `0and[]` and
`1or[]` are valid. See
https://mail.python.org/archives/
Change by Serhiy Storchaka :
--
pull_requests: +19109
pull_request: https://github.com/python/cpython/pull/19786
___
Python tracker
<https://bugs.python.org/issue40
2801 - 2900 of 25874 matches
Mail list logo