Serhiy Storchaka added the comment:
Most (but not all) functions in the math module implicitly convert its
arguments to float. Here we can get an OverflowError. Do we want to add a note
to every function that does it? Or add a general note at the top of the file
and add exclusion notes to
Serhiy Storchaka added the comment:
There is no such constrain. And no default implementation in this module
depends on the constructor. It is important, the constructor is not the part of
interfaces.
If you want to return the same type in denominator, just override it in your
class
Serhiy Storchaka added the comment:
There is no "why". There is a fact that there is no such constrain. Adding a
new constrain may break existing code. If you want to add a constrain, add it
in you code.
If you are interesting "why", try to search old archives for the
Serhiy Storchaka added the comment:
I think you are trying to solve a wrong problem.
> This wasn't obvious because Path objects appear as strings in normal debug
> output, etc.
How is it?
>>> pathlib.Path('/usr/lib')
PosixPath('/usr/lib')
>>>
Serhiy Storchaka added the comment:
pkgutil just skips non-string elements in sys.path.
for dir in search_path:
if not isinstance(dir, str):
continue
--
___
Python tracker
<https://bugs.python.org/issue32
Serhiy Storchaka added the comment:
The module documentation should not contain all historical reasons of every
design decision. If you are interesting why something was done in one way or
another, do your research.
One of reasons is that type(self) not always have a constructor with
Serhiy Storchaka added the comment:
Integral.__add__ is an abstract method, so it is a problem of your
implementation.
--
___
Python tracker
<https://bugs.python.org/issue47
Serhiy Storchaka added the comment:
The function should return different values for success and error. Functions
which do not do this have bad design.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue47
Serhiy Storchaka added the comment:
I am positive about this idea, but we must also think about the possible
negative consequences. For example, the future annotations will be included in
the star-import by default and can override some global names. The fact that
some names not visible in
Serhiy Storchaka added the comment:
It is interesting that you get an UnicodeEncodeError when try to decode. Could
the charser name contain non-ascii characters?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue43
Serhiy Storchaka added the comment:
Issue14265, issue46126.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue47133>
___
___
Python-bug
Serhiy Storchaka added the comment:
It is simpler and faster to return NULL than call PyErr_Occurred(). There is a
special macro PY_RETURN_NONE, so there is no problem with returning None either.
I do not think it would make the code better.
--
resolution: -> rejected
stage: pa
Serhiy Storchaka added the comment:
This is already the third (at least) issue asking for such feature. Many people
have problems with the current output. I would prefer to have a full qualified
name of the test which I can copy by a double click and insert in a command
that reruns
Serhiy Storchaka added the comment:
It does not satisfy your assumptions in msg416056. So you have either correct
your assumptions, or change the implementation of __add__, or change the
implementation of denominator in your code.
--
___
Python
Serhiy Storchaka added the comment:
Sorry, I was puzzled by the exception type and missed details in a long
traceback (I have issues with reading large texts). Thank you for your detailed
report.
The simple fix is to add UnicodeEncodeError to "except LookupError". But there
ma
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +30217
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/32137
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
I fixed all suspicious places for which I found reproducers in PR 32137.
--
___
Python tracker
<https://bugs.python.org/issue43
Change by Serhiy Storchaka :
--
resolution: -> not a bug
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
I once proposed to exclude modules from the star import by default, but this
proposition was rejected. You can try, maybe your proposition will be more
acceptable.
--
___
Python tracker
<ht
Serhiy Storchaka added the comment:
Module objects are not shown in the help unless they are submodules of the
specified module, even if they are imported with the star import. With this
precedence I think it is okay to exclude the __future__ annotations as well
Serhiy Storchaka added the comment:
New changeset 35699721a3391175d20e9ef03d434675b496 by Ma Lin in branch
'main':
bpo-35859: Fix a few long-standing bugs in re engine (GH-12427)
https://github.com/python/cpython/commit/35699721a3391175d20e9ef03d
Serhiy Storchaka added the comment:
Since the old behavior in many cases matches the behavior of Perl and Java
(which are considered bugs, but still), it was decided to not backport the fix
to avoid possible breakage in bugfix releases.
Thank you Ma Lin for your contribution
Serhiy Storchaka added the comment:
I am sorry that I did not test the changes manually, but it seems that
__future__ annotations are now disappeared from the pydoc output for the
__future__ module help.
$ ./python -m pydoc __future__
It is now difficult to get a list of available
Serhiy Storchaka added the comment:
Yet one bug: PR 30888 only changed the text output. But there is also the html
output generator.
--
___
Python tracker
<https://bugs.python.org/issue26
Serhiy Storchaka added the comment:
Fixed in issue35859 together with other bugs, but the fix was only applied to
3.11, because that bug is old and the old behavior matches the behavior in some
other engines (Perl and Java).
--
resolution: -> out of date
stage: needs pa
New submission from Serhiy Storchaka :
I proposed it several years ago on the Python-Dev mailing list and that change
was approved in general. The reorganization was deferred because there were
several known bugs in the RE engine (fixes for which could potentially be
backported) and there
Serhiy Storchaka added the comment:
This looks promising. Please, go ahead! You are free to add any fields to any
opcodes. It may break some third-party code which generates compiled patterns
from a sequence of opcodes, it the stability of this interface was not
promised. And they will be
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +30255
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/32177
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
> Yet one bug: PR 30888 only changed the text output. But there is also the
> html output generator.
Sorry, I was wrong. The changed code is common for all generators. Perhaps I
tested with wrong v
Serhiy Storchaka added the comment:
It turns out that pip uses sre_constants in its copy of pyparsing. The problem
is already fixed in the upstream of pyparsing and soon should be fixed in pip.
We still need to keep sre_constants and maybe other sre_* modules, but
deprecate them.
> Co
Serhiy Storchaka added the comment:
"#" in VERBOSE mode starts a comment and skips to the end of the line. Escape
it: "\#".
--
nosy: +serhiy.storchaka
resolution: not a bug ->
stage: resolved ->
status: closed -> open
_
Change by Serhiy Storchaka :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
Modules with old names are kept (deprecated). The questions are:
1. Should we keep the sre_ prefix in new submodules? Should we prefix them with
underscores?
2. Should we keep only non-underscored names in the sre_* modules or undescored
names too
Serhiy Storchaka added the comment:
New changeset 1be3260a90f16aae334d993aecf7b70426f98013 by Serhiy Storchaka in
branch 'main':
bpo-47152: Convert the re module into a package (GH-32177)
https://github.com/python/cpython/commit/1be3260a90f16aae334d993aecf7b7
Serhiy Storchaka added the comment:
> Is the "import _locale" still used in re/__init__.py? It cannot see any
> reference to it in the code and test_re still if it's removed.
It is true.
> *Maybe* it's time to consider that re.template() and re.Scanner are no
Serhiy Storchaka added the comment:
There are two very different classes with similar names: _sre.SRE_Scanner and
re.Scanner. The former is used to implement the Pattern.finditer() method, but
it could be used in other cases. The latter is an experimental implementation
of generalized lexer
Serhiy Storchaka added the comment:
New changeset 6e3eee5c11b539e9aab39cff783acf57838c355a by Ma Lin in branch
'main':
bpo-23689: re module, fix memory leak when a match is terminated by a signal or
memory allocation failure (GH-32283)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
Thank you Ma Lin for all your work.
The fix changes interfaces of some internal functions which can be used in
third-party code, and the bug occurs only in special circumstances, so it is
not practical to backport it.
--
resolution: -> fi
Serhiy Storchaka added the comment:
Try to create a normal ZIP file (it can be empty), then try to set some byte to
FF (or a pair of bytes to , or 4 consequent bytes to , until you
get the exactly same error). Then you can just add the binary dump of that file
in tests
Change by Serhiy Storchaka :
--
pull_requests: +30351
pull_request: https://github.com/python/cpython/pull/32290
___
Python tracker
<https://bugs.python.org/issue47
Serhiy Storchaka added the comment:
It is a duplicate of issue27546.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue47190>
___
___
Change by Serhiy Storchaka :
--
pull_requests: +30357
pull_request: https://github.com/python/cpython/pull/32298
___
Python tracker
<https://bugs.python.org/issue47
Serhiy Storchaka added the comment:
New changeset 1578f06c1c69fbbb942b90bfbacd512784b599fa by Serhiy Storchaka in
branch 'main':
bpo-47152: Move sources of the _sre module into a subdirectory (GH-32290)
https://github.com/python/cpython/commit/1578f06c1c69fbbb942b90bfbacd51
New submission from Serhiy Storchaka :
They were added in 436c3d58a2570f3b599e59b4071f944f774ec441 (between 1.6a2 and
2.0), but the purpose is not known. See also
https://mail.python.org/archives/list/python-...@python.org/message/DVSQGM5LO4TK63C63H6KQ6XBTBQGFLEN/.
The feature was not fully
Serhiy Storchaka added the comment:
New changeset ff2cf1d7d5fb25224f3ff2e0c678d36f78e1f3cb by Serhiy Storchaka in
branch 'main':
bpo-47152: Remove unused import in re (GH-32298)
https://github.com/python/cpython/commit/ff2cf1d7d5fb25224f3ff2e0c678d3
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +30362
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/32300
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
> Match.regs is an undocumented attribute, it seems it has existed since 1991.
Can it be removed?
It was kept for compatibility with the pre-SRE implementation of the re module.
It was an implementation detail in the original Python code, but I am s
Serhiy Storchaka added the comment:
See issue47211 for removing re.TEMPLATE.
--
___
Python tracker
<https://bugs.python.org/issue47152>
___
___
Python-bug
New submission from Serhiy Storchaka :
The EAFP principle is widely used in the regular expressions parsing code.
Exceptions like KeyError, IndexError, ValueError or OverflowError raised during
parsing are converted into a helpful re.error. Expression chaining is usually
suppressed in such
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +30390
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/32333
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
New changeset b09184bf05b07b77c5ecfedd4daa846be3cbf0a9 by Serhiy Storchaka in
branch 'main':
bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)
https://github.com/python/cpython/commit/b09184bf05b07b77c5ecfedd4daa84
Serhiy Storchaka added the comment:
New changeset 50872dbadcba1f52867b6f76050cd7b5d0aa1e18 by Serhiy Storchaka in
branch 'main':
bpo-47227: Suppress expression chaining for more RE parsing errors (GH-32333)
https://github.com/python/cpython/commit/50872dbadcba1f52867b6f76050cd7
Serhiy Storchaka added the comment:
New changeset 31cd25f4e17cd68487dc76c1b2ec162a646818c2 by Serhiy Storchaka in
branch 'main':
bpo-43464: Optimize set.intersection() for non-set arguments (GH-31316)
https://github.com/python/cpython/commit/31cd25f4e17cd68487dc76c1b2ec16
Serhiy Storchaka added the comment:
New changeset a69a4a917c436579c2c4112081ea86a70f1f05d3 by Serhiy Storchaka in
branch 'main':
bpo-46721: Optimize set.issuperset() for non-set arguments (GH-31280)
https://github.com/python/cpython/commit/a69a4a917c436579c2c4112081ea86
Serhiy Storchaka added the comment:
New changeset 884eba3c76916889fd6bff3b37b8552bfb4f9566 by Serhiy Storchaka in
branch 'main':
bpo-26579: Add object.__getstate__(). (GH-2821)
https://github.com/python/cpython/commit/884eba3c76916889fd6bff3b37b855
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11 -Python 3.7
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: -> resolved
status: open -> closed
versions: +Python 3.11 -Python 3.10
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
dependencies: -Use-after-free by mutating set during set operations
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
:-D
--
___
Python tracker
<https://bugs.python.org/issue37831>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
Batuhan, unfortunately your second solution does not work too, because continue
and break can be conditional. For example:
def simple(x):
for number in range(2):
try:
return number
finally:
if x
Serhiy Storchaka added the comment:
Note, that we have a regression in 3.8. There is a use case for "break" in
"finally", and such code is even used in the stdlib. And who know in what
third-party code it is used. In specific circumstances (see msg349513) it now
can
Serhiy Storchaka added the comment:
PEP 8 contains contradictory examples.
https://www.python.org/dev/peps/pep-0008/#indentation
> # No extra indentation.
> if (this_is_one_thing and
> that_is_another_thing):
> do_something()
>
> # Add a c
Change by Serhiy Storchaka :
--
versions: -Python 3.7
___
Python tracker
<https://bugs.python.org/issue37813>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
What is the minimal Python version for developing CPython? The system Python 3
on current Ubuntu LTS (18.04) is 3.6, so I think it should not be larger.
--
nosy: +serhiy.storchaka
___
Python tracker
<ht
Serhiy Storchaka added the comment:
> I just checked and `python3.6 Tools/unicode/makeunicodedata.py` works fine,
> both at master and with GH-15248.
This is good. But the title mentioned dataclasses, and they are 3.7+.
--
___
Python t
Serhiy Storchaka added the comment:
There may be a solution that does not require a significant change to the code
generator, but small changes in many places with keeping the general structure.
But it is a difficult task, so it takes some time. Don't worry, I'm work
Serhiy Storchaka added the comment:
Other option is to remove a note about datetime hash. It is an implementation
detail.
There are other objects with nondeterministic hash, for example tuples
containing strings, but we should not document this explicitly or make the hash
of all tuples
Serhiy Storchaka added the comment:
I believe that all locale specific things should be in the locale module, not
in the str class.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue37
Serhiy Storchaka added the comment:
> Does anyone know what the rationale was for having & and | on bools return
> bools in the first place?
Besides the fact that they can be defined on bool in compatible way and these
operators often are used for booleans?
It was in the initial
Change by Serhiy Storchaka :
--
pull_requests: +14991
pull_request: https://github.com/python/cpython/pull/15269
___
Python tracker
<https://bugs.python.org/issue29
Change by Serhiy Storchaka :
--
nosy: +benjamin.peterson
___
Python tracker
<https://bugs.python.org/issue29535>
___
___
Python-bugs-list mailing list
Unsub
Serhiy Storchaka added the comment:
I am not sure that it is good idea to accept a type and an instance, but if it
is a goal, is_dataclass() should be defined as:
def is_dataclass(obj):
cls = obj if isinstance(obj, type) else type(obj)
return hasattr(cls, _FIELDS
Serhiy Storchaka added the comment:
1.0e-8 is not a format for numbers in JSON. See RFC 7159
(https://tools.ietf.org/html/rfc7159.html#section-6):
number = [ minus ] int [ frac ] [ exp ]
decimal-point = %x2E ; .
digit1-9 = %x31-39 ; 1-9
e = %x65
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +15039
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/15320
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
PR 15320 fixes a regression by changing the compiler. None is now always pushed
on the stack before entering a try...finally block. The "return" statement with
a non-constant value replaces it, so the stack i
Serhiy Storchaka added the comment:
I afraid this can slow down the Fraction constructor.
--
___
Python tracker
<https://bugs.python.org/issue37836>
___
___
Serhiy Storchaka added the comment:
Sorry, but I do not understand why adding Fraction.as_integer_ratio() prevents
adding math.as_integer_ratio().
The user code can not benefit from this until we add as_integer_ratio() to all
numeric numbers, and this is not realistic. For the same reason
New submission from Serhiy Storchaka :
The proposed PR optimizes the Fraction constructor and statistics.mean() (and
several other statistics functions) by using a private helper implemented in C
which abstracts converting a number to an integer ratio.
$ ./python -m timeit -s "from frac
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +15047
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/15329
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
See issue37884 which uses a C accelerator.
--
___
Python tracker
<https://bugs.python.org/issue37836>
___
___
Python-bug
Serhiy Storchaka added the comment:
This issue if for optimization only. It does not expand the math module API.
Adding public math.as_integer_ratio() has other benefits (it allows to simplify
the user code), but it is a different issue (see issue37822
Serhiy Storchaka added the comment:
Thank you for your patch hai shi. But note that assertion_error is a static
variable. It is initialized only once. Your change makes it holding a borrowed
reference after first call of compiler_assert(). This does not look reliable.
In any case
Serhiy Storchaka added the comment:
1) __import__() can be used for purpose. I would not change this.
3) How would you distinguish the case when the module have an attribute with
the value is None and when it does not have the attribute at all? This
information would lost with your change
Serhiy Storchaka added the comment:
Agree with Batuhan. There are three dbm implementations in the stdlib: dumb,
ndbm and gnu. It may be possible to implement the "x" flag in the former two,
but gdbm_open() does not support it.
Since by default the implementation is chosen automa
Serhiy Storchaka added the comment:
Batuhan, argument converters and return converters are different things.
I have no opinion about the idea itself. You can try, Zachary, and see whether
it makes the code clearer.
--
nosy: +serhiy.storchaka
Serhiy Storchaka added the comment:
Where it was fixed?
--
___
Python tracker
<https://bugs.python.org/issue37074>
___
___
Python-bugs-list mailing list
Unsub
Serhiy Storchaka added the comment:
I tried to solve this issue myself, and figured out that it is not so simple.
It is possible to make tee() nor crashing, but it is not possible to guarantee
the order of the output without using a lock in tee(). It you can get a
sequence 1, 2, 4, 3
Serhiy Storchaka added the comment:
Closed since this issue contains several unrelated propositions, most of which
have been rejected.
If you want to add helper functions for comparing Elements (shallow and deep,
with and without taking and order of attributes to account, with and without
Serhiy Storchaka added the comment:
Do you mind to create a PR Eryk?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue37894>
___
___
Change by Serhiy Storchaka :
--
nosy: +serhiy.storchaka, vstinner
___
Python tracker
<https://bugs.python.org/issue37907>
___
___
Python-bugs-list mailin
Serhiy Storchaka added the comment:
It was already proposed several times before.
The problem is that what do you expect to get from timedelta(hours=24).hours?
The idiomatic way to convert a timedelta object to a number of hours is:
td = timedelta(...)
number_of_hours = td // timedelta
Change by Serhiy Storchaka :
--
nosy: +gvanrossum, levkivskyi
___
Python tracker
<https://bugs.python.org/issue37920>
___
___
Python-bugs-list mailing list
Unsub
Serhiy Storchaka added the comment:
New changeset e9c90aa43144b0be1e4e393e8cb549573437a5da by Serhiy Storchaka in
branch 'master':
bpo-29535: Remove promize about hash randomization of datetime objects.
(GH-15269)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
> I'm with Raymond here; I don't think this change is desirable for the math
> module, either with or without the leading underscore in the name.
Could you please explain what is wrong in adding a helper function which will
help to convert
Serhiy Storchaka added the comment:
New changeset ef61c524ddeeb56da3858b86e349e7288d68178e by Serhiy Storchaka in
branch 'master':
bpo-37830: Fix compilation of break and continue in finally. (GH-15320)
https://github.com/python/cpython/commit/ef61c524ddeeb56da3858b86e349e7
Change by Serhiy Storchaka :
--
pull_requests: +15151
pull_request: https://github.com/python/cpython/pull/15456
___
Python tracker
<https://bugs.python.org/issue37
Change by Serhiy Storchaka :
--
assignee: -> docs@python
components: +Documentation
nosy: +docs@python
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: security -> behavior
versions: -Python 3.5, Python
Serhiy Storchaka added the comment:
Thank you for your PR Minmin. It was decided to not backport it to 3.7.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8, Python 3.9
___
Python tracke
401 - 500 of 25874 matches
Mail list logo