New submission from Guido:
Python/frozenmain.c:27 -
https://hg.python.org/cpython/file/424fbf011176/Python/frozenmain.c#l27
Memory is allocated for sizeof(wchar_t*) * argc bytes. If argc is 0 (which is a
possibility, see below), then 0 bytes are attempted to allocate.
Note that
New submission from
Guido Ostkamp
:
Hello,
a medium size regular expression crashes Python 2.5.1 as follows:
Traceback (most recent call last):
File "./regtest.py", line 14, in
m = rematch(pa
New submission from Guido Imperiale :
Related to #46382
A class decorated with dataclass(slots=True) can't pass any parameters to the
__init_subclass__ method of its parent class.
from dataclasses import dataclass
class A:
__slots__ = ()
def __init_subclass__(cls
Change by Guido Imperiale :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue46970>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Guido Imperiale :
--
type: -> crash
___
Python tracker
<https://bugs.python.org/issue46970>
___
___
Python-bugs-list mailing list
Unsubscrib
New submission from Guido Imperiale :
Take two objects where hash(a) == hash(b) == -2 exactly, but a != b,
When they are inserted in a dict or set, the __eq__ method is invoked a
whopping 13 times.
Does this have something to do with the special case of hash(-1) = -2?
class C:
def
Guido Imperiale added the comment:
Forgot a counter-example:
{C(1, 0), C(2, 0)}
C((1, 0)).__hash__
C((2, 0)).__hash__
C((1, 0)).__eq__(C((2, 0)))
{C((1, 0)), C((2, 0))}
--
___
Python tracker
<https://bugs.python.org/issue38
Guido Imperiale added the comment:
Of course, the chances that in real life a custom object will have hash == -2
are very small. Different story however is for the actual numbers -1 and -2:
In [2]: %timeit {-1, -3
New submission from Guido Imperiale :
The documentation for the pickle module states, about the 3rd element of the
tuple returned by __reduce__:
Optionally, the object’s state, which will be passed to the object’s
__setstate__() method as previously described. If the object has no such
New submission from Guido F :
The 'webbrowser' module throws warnings and bad RC codes when running under
Windows Subsystem for Linux (WSL).
This causes libraries that depend on the 'webbrowser' module to mistakenly
assume there's been an error opening a URL. An exam
Guido F added the comment:
My code patch uses ‘wslview’, which is a binary that is injected into every
WSL distro and forwards file open commands to windows.
I detect WSL inspecting the kernel version, which includes WSL tagging.
On Tue, Nov 2, 2021 at 3:05 PM Steve Dower wrote:
>
>
Guido F added the comment:
Understood, my mistake.
I wonder if explorer.exe or any other general purpose open command is
guaranteed to be available in all WSL distros. There’s also a consideration
to be made on WSL1 vs WSL2 (only v2 ships an actual Linux kernel).
For detection, there’re some
New submission from Guido Imperiale :
Python 3.7.5 and 3.8.0
A decorator causes inspect.getsource() to return clipped output:
from collections import defaultdict
from functools import wraps
import inspect
def foo(*args):
def decorator(func):
@wraps(func)
def wrapper
New submission from Guido Imperiale :
(1)
In the documentation for loads(), the name for the first argument of loads is
'bytes_object'. The actual signature, both in pickle.py and _pickle.c, it is
instead 'data'.
(2)
In the documentation and in pickle.py, the default va
New submission from Guido Kollerie :
When logging messages with variable data one typically writes:
username = 'Guido'
logging.info('User %s logged in', username)
However Python 3 has support str.format (PEP 3101). If one has adopted
str.format for formatting stri
Guido Kollerie added the comment:
I see, could this be made to work if I explicitly request a logger instead?:
logger = logging.getLogger('my_logger', style='{')
logger.info('User {} logged in', username)
Maybe even for the root logger:
root_lo
Change by Guido Imperiale :
--
nosy: +crusaderky
___
Python tracker
<https://bugs.python.org/issue36456>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Guido Vranken :
The following will hang, and consume a large amount of memory:
from email.parser import BytesParser, Parser
from email.policy import default
payload = "".join(chr(c) for c in [0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x2d, 0x54, 0x79, 0x70,
Guido Vranken added the comment:
Hi,
I've built a generic Python fuzzer and submitted it to OSS-Fuzz.
It works by implementing a "def FuzzerRunOne(FuzzerInput):" function in Python
in which some arbitrary code is run based on FuzzerInput, which is a bytes
object.
This is a
Guido Vranken added the comment:
I used fuzzing to find this bug. After applying your patch, the infinite loop
is gone and it cannot find any other bugs of this nature.
--
___
Python tracker
<https://bugs.python.org/issue37
New submission from Guido Reina:
In the file: Lib/_markupbase.py, function: "_parse_doctype_element" there is:
if '>' in rawdata[j:]:
return rawdata.find(">", j) + 1
rawdata[j:] is being scanned twice.
It would be better to do:
pos = rawdata.find(&quo
Guido Reina added the comment:
I am attaching a .tgz file with the tests I have performed.
The .tgz file contains also a README.txt file with more detailed information.
I have done the following test:
The script loads the HTML file 'search.html' in 'rawdata' and searches
New submission from Guido Vranken:
Proof of concept:
# Script for Python 2
import urllib2
opener = urllib2.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0' + chr(0x0A) + "Location:
header injection")]
response = opener.open("http://localho
Guido Vranken added the comment:
Serhiy Storchaka: good call on changing my 'n += (width + precision) < 20 ? 20
: (width + precision);' into 'if (width < precision) width = precision;', I
didn't realize that sprintf's space requirement entails using the l
Guido Vranken added the comment:
I'd also like to add that, although I agree with Guido van Rossum that the
likelihood of even triggering this bug in a general programming context is low,
there are two buffer overflows at play here (one stack-based and one
heap-based), and giv
New submission from Guido Vranken:
Tools/scripts/ftpmirror.py does not guard against arbitrary path constructions,
and, given a connection to a malicious FTP server (or a man in the middle
attack), it is possible that any file on the client's filesystem gets
overwritten. Ie,. if we su
New submission from Guido Vranken:
The vulnerability described here is exceedingly difficult to exploit, since
there is no straight-forward way an "attacker" (someone who controls a Python
script contents but not other values such as system environment variables), can
control
Guido Treutwein added the comment:
Yurys answer and resolution misses the point. Nobody complained about the await
operator. Fact is, that in the _power_ operator (chapter 6.5) as base
specification now "await" is given. This is likely to be an inadvertent copy of
the previous chap
Guido Treutwein added the comment:
I'm with David here, in that a change would improve ease of comprehension:
I still find it strange, that the grammar symbol has the same name as the
keyword (or in the proposed version keyword+'expr'), which is never done on
more widely used
Guido van Rossum added the comment:
This is not really just a doc issue then, is it? Maybe we should just deprecate
the feature?
--
___
Python tracker
<https://bugs.python.org/issue46
Guido van Rossum added the comment:
I recommend opening an issue here:
https://github.com/python/typing/issues/new/choose
--
___
Python tracker
<https://bugs.python.org/issue46
New submission from Guido van Rossum :
In https://github.com/python/cpython/pull/30096#discussion_r768802144 it is
pointed out that the hash seed can be changed if the interpreter is reset.
To guard against this we need to force (re)calculation of all hash seeds in the
generated code when
Guido van Rossum added the comment:
Couldn't we just change the first occurrence of "central location" in the note
to "a central location" and the second to "(different) central locations"? That
would leave Steven's intention intact but satisfy thos
Guido van Rossum added the comment:
We should have a discussion here about improvements that Mark Shannon would
like to see, in particular to do more work in the compiler instead of the
interpreter.
--
nosy: +Mark.Shannon, gvanrossum
___
Python
Guido van Rossum added the comment:
Never mind, this was based on incorrect information. See subsequent messages in
the linked thread.
--
resolution: -> not a bug
stage: test needed -> resolved
status: open -> closed
___
Python tracke
New submission from Guido van Rossum :
I am trying to build under Visual Studio (the 2019 release) and I'm
encountering the following weird issue. In the project file
PCbuild\_freeze_module.vcxproj there's a command that runs the
Tools\scripts\deepfreeze.py script to generate some
Change by Guido van Rossum :
--
keywords: +patch
pull_requests: +28346
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30127
___
Python tracker
<https://bugs.python.org/issu
Guido van Rossum added the comment:
Great! I will leave it to Steven and Mark D to work out an acceptable solution.
PS. Allen Downey is a computer scientist who has written at least one book
about Python.
--
___
Python tracker
<ht
Guido van Rossum added the comment:
I think a 3.10 backport would be appreciated.
--
___
Python tracker
<https://bugs.python.org/issue45755>
___
___
Python-bug
Guido van Rossum added the comment:
I don't see a reason to go through the bootstrap python on Windows. It would
increase the build time, which is already pretty slow.
--
___
Python tracker
<https://bugs.python.org/is
Guido van Rossum added the comment:
A thread without a frame looks like a natural end case when you consider the
frames as a linked list. Could it be that exec()/eval() run in the current
frame, and if there isn't a frame, they refuse to run? (Sorry, I don't recall
anything mor
Guido van Rossum added the comment:
I presume https://github.com/faster-cpython/ideas/discussions/194 is also
relevant.
--
___
Python tracker
<https://bugs.python.org/issue46
Change by Guido van Rossum :
--
nosy: -gvanrossum
___
Python tracker
<https://bugs.python.org/issue45235>
___
___
Python-bugs-list mailing list
Unsubscribe:
Guido van Rossum added the comment:
> Note: attrgetter could easily be made faster by migrating it to use
> vectorcall.
Sure, though code that *doesn't* use attrgetter is usually easier to read --
attrgetter is rare enough in my experience that I usually have to look it up.
Guido van Rossum added the comment:
Yes, it is too late for 3.10 (but you can add it to typing_extensions). Also,
PEP 585 is done, we don't update PEPs. Please do test with `from __future__
import annotations` -- you never know.
When this was first proposed (https://github.com/python/t
Guido van Rossum added the comment:
We managed to do this for 'with' so it should be possible here too, I'd think.
The "committing" token would be the newline following the close parenthesis.
Serhiy: the benefit is when you want to split it acros
Guido van Rossum added the comment:
I like the lookahead. We could also make the comma and the message mandatory
when inside parentheses:
| 'assert' '(' a=expression ',' b=expression [','] ')' &(NEWLINE | ';')
| '
Guido van Rossum added the comment:
You don’t have to use the new feature. But people expect it to work.
--
___
Python tracker
<https://bugs.python.org/issue46
Guido van Rossum added the comment:
See https://github.com/python/mypy/issues/9773#issuecomment-1000975000. I may
have talked myself into agreeing with Serhiy there! It does seem inconsistent
that Any is not considered a type but list[int] is:
>>> isinstance(list[int], type)
True
&
Guido van Rossum added the comment:
Do you have evidence that people make this particular mistake often? And that
the suggested solution is indeed what they should use? Why would you want to
subclass UserId?
Do we have examples of other error messages split across two lines like this
Guido van Rossum added the comment:
Weird, the docs you cite claims
# Also does not typecheck
ProUserId = NewType('ProUserId', UserId)
but when I try it, it works at runtime and passes mypy (even with --strict) and
also pyright.
So maybe those docs are incorrect? I
Guido van Rossum added the comment:
There's no point in lamenting the compatibility with Python 3.6, it's water
under the bridge. Dispatching on types like list[int] or types generated by
NewType is not realistic. Maybe the only thing left to do is to raise an error
on registratio
Guido van Rossum added the comment:
That mypy error is only reported with a certain mypy setting (--strict, or
probably one of the specific settings that that turns on).
We won't be supporting Sequence[Any] at runtime (because we only support actual
types), but we should support Seq
Guido van Rossum added the comment:
Let's close this issue as "won't fix" then. The solution "use
collections.abc.Sequence" makes sense.
--
___
Python tracker
<h
Guido van Rossum added the comment:
Could you try with 3.10 and the stdlib typing.Annotated please? There might
be changes (in the past a default of None automatically caused an Optional
to be added, but we changed our minds.--
--Guido (mobile
Guido van Rossum added the comment:
If we allow registering list[int] but give it the same meaning as registering
plain list (at runtime), that would violate user expectations pretty strongly
-- for the same reason why we don't allow isinstance(x, list[int]).
If you want stronger che
Guido van Rossum added the comment:
Yes, we changed PEP 484 in https://github.com/python/peps/pull/689.
So get_type_hints() should follow suit.
--
___
Python tracker
<https://bugs.python.org/issue46
Change by Guido van Rossum :
--
nosy: -gvanrossum
___
Python tracker
<https://bugs.python.org/issue44394>
___
___
Python-bugs-list mailing list
Unsubscribe:
Guido van Rossum added the comment:
Let me have a look. May take a day, okay?--
--Guido (mobile)
--
___
Python tracker
<https://bugs.python.org/issue46
Guido van Rossum added the comment:
So if I understand the speed.python.org results correctly, the time to run
`python -c pass` went way up, but the time for `python -S -c pass` did not go
up significantly.
Unfortunately the only machine I have access to is a Mac, and I cannot repro
this
Guido van Rossum added the comment:
Maybe it's Linux specific? I managed to run pyperformance and got this:
### python_startup ###
Mean +- std dev: 23.2 ms +- 0.8 ms -> 23.4 ms +- 1.2 ms: 1.01x slower
Not significant
Note, I am not dismissing the report -- in fact it looks quite ba
Guido van Rossum added the comment:
Maybe something unrelated changed on the benchmark machines? (Like installing a
new version of pyperformance???) Though it happened across both benchmark
machines. What configuration and flags are being used to run the benchmark
suite on that machine
Guido van Rossum added the comment:
I propose a test: revert the PR and see if speed.Python.org shows a speedup
back to the previous number.--
--Guido (mobile)
--
___
Python tracker
<https://bugs.python.org/issue46
Guido van Rossum added the comment:
Confirmed about _TypeVarLike. Go ahead and make a PR. Do add a news blurb when
requested.
Please open separate issues for other such classes, each fix may need to be
reviewed by a different expert
Guido van Rossum added the comment:
I wrote a tiny script that calls compile() on raw bytes read from some source
file, does this 100 times, and reports the total time. I tested the script with
Lib/pydoc_data/topics.py (which happens to be the largest source file in the
CPython repo, but
Guido van Rossum added the comment:
"is very very unlike that there is no actual regression"
I presume you meant
"it is very very *likely* that there is no actual regression"
This shouldn't hold up releases, but (having spent months trying to improve
startup spe
Guido van Rossum added the comment:
So is it too late to change this? This went out with 3.10, Serhiy has argued
it's a bugfix.
--
___
Python tracker
<https://bugs.python.org/is
Guido van Rossum added the comment:
Okay, so it is probably here to stay. We could justify it (after the fact :-)
by saying that you can instantiate list[int], but not Any.
Are there exceptions to that? (I.e. are there other annotation types that have
isinstance(X, type) return False but
Guido van Rossum added the comment:
I'm still wondering why speed.python.org showed such a slowdown, and how we can
revert that. Here's a new theory.
Thanks to an investigation I did together with Eric, I now suspect that the
release of setuptools 60.0.0 on Dec 19 is a s
Guido van Rossum added the comment:
More data. On my Mac, with SETUPTOOLS_USE_DISTUTILS=stdlib, using -X importtime
I see the following extra modules being imported:
import time: 278 |278 | types
import time: 112 |112 | _operator
import time
Guido van Rossum added the comment:
I now agree with Serhiy's plan. We should execute ASAP so people get a chance
to try this in the next alpha release.
We will still allow instantiating e.g. list[int], right?
--
___
Python tracker
&
Change by Guido van Rossum :
--
title: FreeBSL buiildbots cannot compile Python -> FreeBSD buildbots cannot
compile Python
___
Python tracker
<https://bugs.python.org/issu
Guido van Rossum added the comment:
Is this under control, or do you still need help with some part? (Are there
two separate issues or not?)--
--Guido (mobile)
--
___
Python tracker
<https://bugs.python.org/issue46
Guido van Rossum added the comment:
IIUC Steve is still on vacation, so we shouldn't wait for him to fix this.
--
___
Python tracker
<https://bugs.python.org/is
Guido van Rossum added the comment:
Niklas, can you show a brief example showing the issue you're running into? Is
it just that list["Node"].__args__ is just ("Node",), not
(ForwardRef("Node"),)? Or is it more complex?
--
___
Guido van Rossum added the comment:
Deep-freezing is definitely not a miracle cure. We should continue to trim or
delay unneeded imports (like Christian just did for setuptools'
_distutils_hack).
What *would* be a miracle cure would be if we could deep-freeze the module
contents aft
Guido van Rossum added the comment:
To close the loop, setuptools 60.4.0 should fix this, see
https://github.com/pypa/setuptools/pull/3009.
--
___
Python tracker
<https://bugs.python.org/issue46
Change by Guido van Rossum :
--
nosy: -gvanrossum
___
Python tracker
<https://bugs.python.org/issue46148>
___
___
Python-bugs-list mailing list
Unsubscribe:
Guido van Rossum added the comment:
Yup. All better:
https://speed.python.org/timeline/#/?exe=12&ben=python_startup&env=1&revs=50&equid=off&quarts=on&extr=on
--
___
Python tracker
<https:/
Change by Guido van Rossum :
--
stage: -> needs patch
___
Python tracker
<https://bugs.python.org/issue46333>
___
___
Python-bugs-list mailing list
Unsubscrib
Guido van Rossum added the comment:
Good catch. Do you want to submit a PR? I agree that the repr() could also be
better (but please only show other values if they differ from the default).
--
versions: +Python 3.11
___
Python tracker
<ht
Guido van Rossum added the comment:
Since the conclusion is that we can't do this without breaking backwards
compatibility, should we just close this? Or is there still a compromise
possible?
--
___
Python tracker
<https://bugs.py
Guido van Rossum added the comment:
Thanks for the bisection. It's not surprising that that's the culprit, and in
other situations that's the right thing to do. I'm not sure how to address this
without breaking other stuff -- maybe leave the ForwardRef if evaluating i
Guido van Rossum added the comment:
Yes.--
--Guido (mobile)
--
___
Python tracker
<https://bugs.python.org/issue46244>
___
___
Python-bugs-list mailin
New submission from Guido van Rossum :
I am getting these warnings:
C:\Users\gvanrossum\cpython\PC\_testconsole.c(70,38): warning C4013:
'_Py_get_osfhandle' undefined; assuming extern returnin
g int [C:\Users\gvanrossum\cpython\PCbuild\_testconsole.vcxproj]
C:\Users\gvanrossum\
Change by Guido van Rossum :
--
nosy: +gvanrossum
___
Python tracker
<https://bugs.python.org/issue46303>
___
___
Python-bugs-list mailing list
Unsubscribe:
Guido van Rossum added the comment:
New changeset e2a9c8ef09cb7123d6b28852a323e6cc1f878b5b by Nikita Sobolev in
branch 'main':
bpo-46348: modernize `test_typing` (GH-30547)
https://github.com/python/cpython/commit/e2a9c8ef09cb7123d6b28852a323e6
Guido van Rossum added the comment:
New changeset 0bbf30e2b910bc9c5899134ae9d73a8df968da35 by Jelle Zijlstra in
branch 'main':
bpo-46342: make @typing.final introspectable (GH-30530)
https://github.com/python/cpython/commit/0bbf30e2b910bc9c5899134ae9d73a
Guido van Rossum added the comment:
New changeset 1de60155d5d01be2924e72fb68dd13d4fd00acd7 by Nikita Sobolev in
branch 'main':
bpo-46345: Add a test case for implicit `Optional` class attribute (GH-30535)
https://github.com/python/cpython/commit/1de60155d5d01be2924e72fb68dd13
Guido van Rossum added the comment:
Wasn’t the fix for it also backported?
(Weird that the test wasn’t part of the fix.)
--
___
Python tracker
<https://bugs.python.org/issue46
Guido van Rossum added the comment:
Okay, PR welcome.
(Though since this can only work for 3.11+,
maybe typeshed could also be adjusted?
For that you’d have to file a bug there.)
--
___
Python tracker
<https://bugs.python.org/issue46
Guido van Rossum added the comment:
[Meta: Why did adding a comment add all those people (back?) to the nosy list?]
--
___
Python tracker
<https://bugs.python.org/issue12
Guido van Rossum added the comment:
Probably.
On Mon, Jan 17, 2022 at 02:14 Alex Waygood wrote:
>
> Alex Waygood added the comment:
>
> Do these changes warrant an entry in "What's New in 3.11"?
>
> --
>
> ___
New submission from Guido van Rossum :
This saves some space when strings are shared across deep-frozen module.
Kumar measured this at around 0.2 Mbyte.
See discussion https://github.com/faster-cpython/ideas/issues/218
--
___
Python tracker
<ht
Guido van Rossum added the comment:
Given all this discussion I defer to Serhiy and Inada-San.
On Wed, Jan 19, 2022 at 02:23 Serhiy Storchaka
wrote:
>
> Serhiy Storchaka added the comment:
>
> I share concerns of Inada-san. I also think that keeping a status quo
> (ignor
Guido van Rossum added the comment:
New changeset 263c0dd16017613c5ea2fbfc270be4de2b41b5ad by Nikita Sobolev in
branch 'main':
bpo-46437: remove useless `hasattr` from `test_typing` (#30704)
https://github.com/python/cpython/commit/263c0dd16017613c5ea2fbfc270be4de2b41b5ad
-
New submission from Guido van Rossum :
This seems to happen in 3.11 in the REPL only.
>>> def f():
... print(0)
... return yield 42
File "", line 3
def f():
^
SyntaxError: invalid syntax
Note that running it from a file gives the expected output:
PS
Guido van Rossum added the comment:
New changeset 194ecc6d44adc1fb39a56ca696418368b69432ce by Kumar Aditya in
branch 'main':
bpo-46443: deepfreeze: use small ints and singleton zero bytes (GH-30715)
https://github.com/python/cpython/commit/194ecc6d44adc1fb39a56ca6964183
Guido van Rossum added the comment:
Thanks for the quick fix!
--
___
Python tracker
<https://bugs.python.org/issue46441>
___
___
Python-bugs-list mailin
Guido van Rossum added the comment:
New changeset ef3ef6fa43d5cca072eed2a66064e818de583be7 by Kumar Aditya in
branch 'main':
bpo-46429: Merge all deepfrozen files into one (GH-30572)
https://github.com/python/cpython/commit/ef3ef6fa43d5cca072eed2a66064e8
1 - 100 of 5563 matches
Mail list logo