[issue46126] Unittest output drives developers to avoid docstrings

2021-12-24 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45665] Problems caused by isinstance(list[int], type) returning True

2021-12-24 Thread Guido van Rossum


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
>>> import typing
>>> isinstance(typing.Any, type)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2021-12-24 Thread Alex Walters


New submission from Alex Walters :

When zero argument super is used inside a generator expression, it raises 
'TypeError: super(type, obj): obj must be an instance or subtype of type'.

I can find no information on if this is working as intended, a bug, or a known 
issue, and the error isn't helping.  Attached is a minimal example of the error.

--
files: superbug.py
messages: 409166
nosy: tritium
priority: normal
severity: normal
status: open
title: Zero argument super() does not function properly inside generator 
expressions
versions: Python 3.9
Added file: https://bugs.python.org/file50518/superbug.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46174] Feature Request for Python Interfaces

2021-12-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

(IDLE does not support typing.Protocol classes, because no one has proposed 
that it do so, let alone submit a patch.)

A new keyword requires a PEP that specifies the syntax for an 'interface' 
statement and what such a statement would do.  You should start with discussion 
on the python-ideas list.  This should probably be closed until there is a 
concrete proposal that could be evaluated and possibly implemented or rejected.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46172] [doc] Outdated description of `license` object

2021-12-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

On Windows, with the python.orgs 3.9.9, 3.10.1, and 3.11.0b3 installers, 
'licence' displays the documented text. Ditto for all 3 build from repository.  
Ditto for 3.10.1 on Mac.  The behavior is set, I believe, in site.py, so your 
system ignored the doc.  What are you running on?

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46173] float(x) with large x not raise OverflowError

2021-12-24 Thread Cyker Way


Cyker Way  added the comment:

Alright that helps. I guess I now understand what's happening here. Here are 
the two numbers in question:

>>> M = int('1'*53+'0'*971, 2)
>>> N = int('1'*53+'0'+'1'*970, 2)

M is the largest number in binary64 range, while N is the largest number that 
does not emit an OverflowError when converted to binary64. N+1 will emit that 
error. N-M == 2**970-1 which means N is larger than M that caused the confusion.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46166] Get "self" args or non-null co_varnames from frame object with C-API

2021-12-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Pablo, Mark: I am guessing that at least one of you know about this.

--
nosy: +Mark.Shannon, pablogsal, terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46126] Unittest output drives developers to avoid docstrings

2021-12-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I also use comments in lieu of docstrings for text_xyx methods because I find 
the addition of the first line of the docstring in error reports to be useless, 
distracting, and sometimes, depending on the content, confusing.  If the error 
is in the test method, the full comment is available when looking back at the 
method code.  If the error is in the tested code, the comment/docstring is 
inapplicable.

When I edit test files, I run them directly from an IDLE editor via the 'if 
__name__' clause.  When I run all IDLE tests from Command Prompt, I usually run 
'python -m test.test_idle'.  (Similar but not necessarily identical to 'python 
-m -ugui test_idle'.)  So fiddling with regrtest will not help in either case.

Based on the above, the following seems to work.
runner = unittest.TextTestRunner(descriptions=False, verbosity=2)
unittest.main(testRunner=runner)
I am not sure what passing a runner does, versus leaving the default None, but 
the verbosity passed to the runner overrides and verbosity argument passed to 
main.  What I would like is 'descriptions' added as a parameter to main, so that
unittest.main(descriptions=False, verbosity=2)
would work.

--
nosy: +terry.reedy -eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46162] Make `builtins.property` generic

2021-12-24 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Serhiy, no, we can infer that.

There are two general cases:

1. `x = property(x_get, x_set)`, it is just ideal
2. `@property x` and `@x.setter`, it is also inferable with a bit of special 
casing for the mutable type part (we mutate the type of `x` when adding a 
setter)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46126] Unittest output drives developers to avoid docstrings

2021-12-24 Thread Éric Araujo

Éric Araujo  added the comment:

> I presume I don't need to explain why docstrings are nice and preferable over 
> comments.

Actually, can you?

Docstrings to document regular modules, classes or functions are a fine tool, 
especially with tools that extract them (pydoc, sphinx).  I don’t see the same 
need for test functions.

--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46120] Add note to `typing.Union` that it is recommended to use `|` instead

2021-12-24 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +28472
pull_request: https://github.com/python/cpython/pull/30250

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46162] Make `builtins.property` generic

2021-12-24 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46162] Make `builtins.property` generic

2021-12-24 Thread Marc Mueller


Change by Marc Mueller :


--
nosy: +cdce8p

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46120] Add note to `typing.Union` that it is recommended to use `|` instead

2021-12-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 1b30660c3b40da557050948ac8635f2dc50c4ee2 by Nikita Sobolev in 
branch 'main':
bpo-46120: State that `|` is preferred over `Union` (GH-30222)
https://github.com/python/cpython/commit/1b30660c3b40da557050948ac8635f2dc50c4ee2


--
nosy: +gregory.p.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10202] ftplib doesn't check close status after sending file

2021-12-24 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
stage: test needed -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10202] ftplib doesn't check close status after sending file

2021-12-24 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.1, Python 
3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10202] ftplib doesn't check close status after sending file

2021-12-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

[pasting in my investigation that I replied with on a mailing list:]

The possible problem does appear real but it likely not frequently observed and 
is something most people reading the code wouldn't see as it's rather esoteric:

https://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable
via 
https://stackoverflow.com/questions/8874021/close-socket-directly-after-send-unsafe
 describes the scenario.

So does this apply in Python?

Apparently.  Our socket module close() is simply calling close as expected.
 https://github.com/python/cpython/blob/main/Modules/socketmodule.c#L3132 ->
 https://github.com/python/cpython/blob/main/Modules/socketmodule.c#L443

Our ftplib code that implicitly calls close on the data connection when exiting 
the
 `with self.transfercmd(cmd, rest) as conn: ` context manager
https://github.com/python/cpython/blob/main/Lib/ftplib.py#L498`

Triggers a close() without a prior shutdown(socket.SHUT_RDWR) + read() -> EOF 
or timeout dance.

In most protocols this isn't a big deal. ftp being so old as to rely solely on 
the TCP connection itself is the outlier.

How often does this happen in practice?  I don't know.  I haven't heard of it 
happening, but how many people honestly use ftplib to send data between 
operating systems where a socket close triggering a TCP RST rather than FIN on 
the sender might be more likely in the past 20 years?  I suspect not many.  

The code can be improved to prevent it.  But I don't believe it'll be feasible 
to construct a real world not-mock-filled regression test that would fail 
without it.

Potential solution:
  Do the shutdown+recv EOF dance as the final step inside of the storbinary and 
storlines `with self.transfercmd as conn` blocks.

Technically speaking socket.socket.shutdown() is conditionally compiled but I 
don't know if any platforms lacking the socket shutdown API exist anymore (my 
guess is that conditional compilation for shutdown is a leftover from the 
1990s). If so, a "if hasattr(conn, 'shutdown'):" conditional before the added 
logic would suffice.

Looking at various ftp client source code (netkit ftp & netbsd ftp - both bsd 
derivatives) as well as a modern gonuts golang one I do not see them explicitly 
doing the shutdown dance.  (I didn't dive in to figure out if it is hidden 
within their flclose() or conn.Close() implementations as that'd be surprising)

--
nosy: +gregory.p.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2756] urllib.request.add_header fails with existing unredirected_header

2021-12-24 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: urllib2 add_header fails with existing unredirected_header -> 
urllib.request.add_header fails with existing unredirected_header

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2756] urllib2 add_header fails with existing unredirected_header

2021-12-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Bug needs to be verified on 3.10 or 3.11.

--
nosy: +terry.reedy
versions: +Python 3.10, Python 3.11 -Python 2.6, Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4079] urllib.requst.Request 'timeout' attribute needs to have a default

2021-12-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

urllib2 became urllib.request in 3.x.  In 2.6, 'timeout' became a parameter of 
both urlopen and OpenerDirector.open.  In both cases the default was and is the 
'global default timeout setting'.  So 'timeout' has a default.

Both functions take a Request object in lieu of a url.  I see no indication 
that the Request object itself ever has a timeout attribute, at least not in 
.__init__.  It certainly does not now.  It seems that the idea was that 
timeouts are a property of an open action, not of the reusable Request object 
that wraps a url.


CacheFTPHandler.setTimeout() is for FTP handlers.

So it seems that this should be closed as either 'not a bug' or 'out of date'.

--
nosy: +terry.reedy
title: new urllib2.Request 'timeout' attribute needs to have a default -> 
urllib.requst.Request 'timeout' attribute needs to have a default
versions: +Python 3.11 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37295] Possible optimizations for math.comb()

2021-12-24 Thread Tim Peters


Tim Peters  added the comment:

If people are keen to speed comb() for larger arguments, the approach in 
Stefan's "comb_with_primes.py" is very much worth looking at. I've played with 
that idea before, and it runs circles around any other approach I've seen.

The only divisions it does are of integers no larger than n by primes no larger 
than k (the "effective" k: min(k, n-k)). The current CPython implementation 
guarantees the latter fit in a C "long long", so the divisor is never notably 
stressful.

The downside is that it requires O(log(n) * k) temp storage, to hold 
list(range(n, n-k, -1)), and O(k) temp storage to hold a sieve to find the 
primes <= k.

A subtlety: Stefan's `myprod()` is also important to its speed gains when k 
gets large. For example, given xs = list(range(1, 100)), math.prod(xs) 
takes over 40 times longer than myprod(xs). myprod() is obscurely coded 
(presumably for peak speed), but effectively arranges the multiplications in a 
complete binary tree (e.g., myprod([1, 2, 3, 4, 5, 6, 7, 8]) is evaluated as 
((1*2)*(3*4))*((5*6)*(7*8))). This gives Karatsuba multiplication good chances 
to get exploited at higher levels in the tree.

The "divide-and-conquer" recurrence already checked in also bought speed gains 
by getting Karatsuba in play, but is much less effective overall because it can 
still need divisions of giant ints by giant ints. Then again, it's frugal with 
memory.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46174] Feature Request for Python Interfaces

2021-12-24 Thread Gobot1234


Gobot1234  added the comment:

> Protocol class is not supported by IDEs for type hints, completions, bug 
> findings, etc.

I think most good modern IDEs support using Protocols as type hints, offer 
completions on them and help you to find bugs with static analysis. That was 
one of the main reasons they were implemented.

--
nosy: +Gobot1234

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46171] venv module produces spurious warning that location has moved

2021-12-24 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46125] Test the preferred API instead of relying on legacy for coverage

2021-12-24 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46118] Migrate importlib.resources into a package

2021-12-24 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46173] float(x) with large x not raise OverflowError

2021-12-24 Thread Mark Dickinson


Change by Mark Dickinson :


--
resolution:  -> not a bug

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46173] float(x) with large x not raise OverflowError

2021-12-24 Thread Mark Dickinson

Mark Dickinson  added the comment:

If we wanted to make a change, I think the part of the docs that I'd target 
would be this sentence:

> a floating point number with the same value (within Python’s floating point 
> precision) is returned

It's that "same value (within Python's floating point precision)" bit that I'd 
consider changing. We could consider replacing it with something along the 
lines that "an integer argument is rounded to the nearest float", possibly with 
an additional note that under the assumption of IEEE 754 binary64 format, we 
follow the usual IEEE 754 rules.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46173] float(x) with large x not raise OverflowError

2021-12-24 Thread Mark Dickinson


Mark Dickinson  added the comment:

Yes, exactly: Python's intentionally following the normal IEEE 754 rules for 
rounding a value to the binary64 format using the round-ties-to-even rounding 
rule, as formalised in section 7.4 of IEEE 754-2019 (and quoted by @cykerway). 
These are the exact same rules that are followed for conversion from str to 
float (where we return `inf` rather than raise `OverflowError` for large 
values, but the overflow boundary is the same), or conversion from Fraction to 
float, or conversion from Decimal to float, etc.

> the python float doc might better say "If the *rounded* argument is 
> outside..."

Docs are hard. I think there's a danger that that word "rounded" would cause 
more confusion than it alleviates - to me, it suggests that there's some kind 
of rounding going on *before* conversion to float, rather than *as part of* the 
conversion to float. This isn't a language specification document, so it's not 
reasonable to give a perfectly accurate description of what happens - the 
actual meaning would be lost in the mass of details. (In this case, it would 
also be rather hard to be precise, given that we have to allow for platforms 
that aren't using IEEE 754.) I'm not seeing an obvious way to improve the docs 
here.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46173] float(x) with large x not raise OverflowError

2021-12-24 Thread Cyker Way

Cyker Way  added the comment:

IEEE 754, 7.4 Overflow:

>   The overflow exception shall be signaled if and only if the destination 
> format’s largest finite number is exceeded in magnitude by what would have 
> been the rounded floating-point result (see 4) were the exponent range 
> unbounded...

Were this the basis of the float implementation, not raising an overflow 
exception seems to be the correct behavior? Then this is not a bug, but the 
python float doc might better say "If the *rounded* argument is outside..."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46174] Feature Request for Python Interfaces

2021-12-24 Thread Or


New submission from Or :

Most object oriented languages provide interfaces as part of the core language, 
this helps bring better design principles to a team's workflows.

Today Python provides the ABC module for abstract base classes and the Protocol 
class from typing module as something that might resemble an interface.

Creating abstract classes to simulate interface behavior is pretty tedious and 
the Protocol class is not supported by IDEs for type hints, completions, bug 
findings, etc.

I think the Python community would really benefit if we have an interface 
keyword built into the core language and enforced by the interpreter, similar 
to how it's implemented in Java and C#.

--
messages: 409149
nosy: Orie
priority: normal
severity: normal
status: open
title: Feature Request for Python Interfaces
type: enhancement
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46173] float(x) with large x not raise OverflowError

2021-12-24 Thread Cyker Way


Cyker Way  added the comment:

If python's float strictly adheres to IEEE 754 binary64 (is that so?), then the 
problem may be caused by rounding. However, even in that case I still don't get 
the benefits of doing range check on a rounded input but not the input itself. 
Does IEEE 754 itself give any specifications about range check and rounding 
during such type conversion?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46167] Parse assert (x == y, "Descriptive text") as statement params instead of a tuple

2021-12-24 Thread Guido van Rossum

Guido van Rossum  added the comment:

You don’t have to use the new feature. But people expect it to work.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46169] Same-moment datetimes with different ZoneInfo timezones are not considered ==

2021-12-24 Thread Daniel Diniz


Change by Daniel Diniz :


--
nosy: +belopolsky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46173] float(x) with large x not raise OverflowError

2021-12-24 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

float(x) performs rounding. Only if the value after rounding is out of range is 
OverflowError raised.

M + 1, when correctly rounded to the nearest even float, gives 
sys.float_info.max. Likewise for M+2, M+3 etc all the way to M+K where K equals 
2**960 before the correctly rounded result of float(M+K) overflows.

Anything less than K=2**960 is too small to be distinguished from M when added 
to it. So there's no bug here, the behaviour is correct for IEEE-754, although 
perhaps the documentation is misleading.

Mark, is my explanation right?

--
nosy: +mark.dickinson, steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46171] venv module produces spurious warning that location has moved

2021-12-24 Thread Eryk Sun


Eryk Sun  added the comment:

There's still the problem of the system using short names in %TEMP%, since by 
default that's under "%USERPROFILE%\AppData". Either an exception could be made 
for the temp directory, since it's never redirected (AFAIK), or support could 
be added for GetLongPathNameW() [1] as nt._getlongpathname().

---
[1] 
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getlongpathnamew

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46171] venv module produces spurious warning that location has moved

2021-12-24 Thread Eryk Sun


Eryk Sun  added the comment:

There's no point to making the user worry about short names, symlinks, or 
non-canonical mount points in the filesystem path of a virtual environment. 
It's still accessible where the user expects to find it. The problem for 
bpo-45337 is filesystem redirection in UWP apps, in particular for files and 
directories created under "%USERPROFILE%\AppData". The warning could be limited 
to just paths in that tree.

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46173] float(x) with large x not raise OverflowError

2021-12-24 Thread Cyker Way

New submission from Cyker Way :

Acccording to: https://docs.python.org/3/library/functions.html#float

>If the argument is outside the range of a Python float, an OverflowError 
> will be raised.

It is well known that the maximum value in IEEE 754 binary64 format is:

>>> M = ((1<<53)-1)<<(1023-52)
...

So `(M+1)` will be out of range. But `float(M+1)` gives me:

>>> float(M+1)
1.7976931348623157e+308

No OverflowError is thrown. Contrast this with:

>>> float(M+M)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: int too large to convert to float

In another text: 
https://docs.python.org/3/tutorial/floatingpoint.html#representation-error

>   ...Almost all machines today (November 2000) use IEEE-754 floating point 
> arithmetic, and almost all platforms map Python floats to IEEE-754 “double 
> precision”...

Is Python not following IEEE 754 binary64 format or something missing here?

--
components: Interpreter Core
messages: 409143
nosy: cykerway
priority: normal
severity: normal
status: open
title: float(x) with large x not raise OverflowError
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24364] Not all defects pass through email policy

2021-12-24 Thread mike mcleod


mike mcleod  added the comment:

I would like to help with this issue.

--
nosy: +mikecmcleod

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4849] instantiating and populating xml.dom.minidom.Element is cumbersome

2021-12-24 Thread mike mcleod


mike mcleod  added the comment:

I would like to help with this issue. I'm new to this space hence I am not 
aware of what patch review means.

--
nosy: +mikecmcleod

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46156] 3.9.9: python built-in SSL module unable to connect to an IIS server (104 Connection reset by peer), but pyopenssl works fine

2021-12-24 Thread lkraav


lkraav  added the comment:

> I need more information to diagnose the issue. Could you please provide:
> - your operating system and vendor/distribution

Gentoo, so rolling, but 20 years of maintenance experience.

> - your OpenSSL version (ssl.OPENSSL_VERSION)

$ python
Python 3.9.9 (main, Dec 21 2021, 17:21:49) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
@>>> import ssl
@>>> print(ssl.OPENSSL_VERSION)
OpenSSL 1.1.1l  24 Aug 2021


> - how did you install Python (self-compiled, pyenv, system Python)?

System Python. On Gentoo, features configuration revolve around USE flags, but 
I don't have anything curious built with "gdbm ncurses readline sqlite ssl xml" 
being active:

$ eix dev-lang/python$
[U] dev-lang/python
 Available versions:  
 ...
 (3.9)  3.9.9^t{xpak}
 ...
   {berkdb bluetooth build examples gdbm hardened libedit lto +ncurses pgo 
+readline +sqlite +ssl test tk verify-sig wininst +xml ELIBC="uclibc"}
 Installed versions:  3.9.9(3.9)^t{xpak}(17:22:24 21.12.2021)(gdbm ncurses 
readline sqlite ssl xml -bluetooth -build -examples -hardened -lto -pgo -test 
-tk -verify-sig -wininst)
 Homepage:https://www.python.org/
 Description: An interpreted, interactive, object-oriented 
programming language


> - how did you install PyOpenSSL and cryptography?

Regular system package manager install

$ eix pyopenssl
[I] dev-python/pyopenssl
 Available versions:  20.0.1^t{xpak} {doc test PYTHON_TARGETS="pypy3 
python3_8 python3_9 python3_10"}
 Installed versions:  20.0.1^t{xpak}(11:43:07 03.06.2021)(-doc -test 
PYTHON_TARGETS="python3_9 -pypy3 -python3_8 -python3_10")
 Homepage:https://www.pyopenssl.org/ 
https://pypi.org/project/pyOpenSSL/ https://github.com/pyca/pyopenssl/
 Description: Python interface to the OpenSSL library

$ eix cryptography
[I] dev-python/cryptography
 Available versions:  3.4.7-r2^t{xpak} **36.0.0^t {debug test 
PYTHON_TARGETS="pypy3 python3_8 python3_9 python3_10"}
 Installed versions:  3.4.7-r2^t{xpak}(16:35:10 21.12.2021)(-test 
PYTHON_TARGETS="python3_9 -pypy3 -python3_8 -python3_10")
 Homepage:https://github.com/pyca/cryptography/ 
https://pypi.org/project/cryptography/
 Description: Library providing cryptographic recipes and primitives

> - the full output of: openssl s_client -connect webapi.remote:52100

$ openssl s_client -connect webapi.remote:52100 

  
CONNECTED(0003)
depth=0 CN = webapi.remote
verify error:num=18:self signed certificate
verify return:1
depth=0 CN = webapi.remote
verify return:1
---
Certificate chain
 0 s:CN = webapi.remote
   i:CN = webapi.remote
---
Server certificate
-BEGIN CERTIFICATE-

-END CERTIFICATE-
subject=CN = webapi.remote

issuer=CN = webapi.remote

---
No client certificate CA names sent
Peer signing digest: SHA1
Peer signature type: RSA
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 1254 bytes and written 502 bytes
Verification error: self signed certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol  : TLSv1.2
Cipher: ECDHE-RSA-AES256-SHA384
Session-ID: 2706127E5AA837E96D63F5DE532C53FAD1D5C034CBF3D305B7978E9636A0
Session-ID-ctx: 
Master-Key: 
FAE8DE30BF627E7F02F8B4AA856075675FAF3A92365A1E9E8041F799E29CE809749B35514065255C62F0D449405C02B8
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1640346190
Timeout   : 7200 (sec)
Verify return code: 18 (self signed certificate)
Extended master secret: yes
---
DONE

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45865] Old syntax in unittest

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Not worth the hassle.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46172] [doc] Outdated description of `license` object

2021-12-24 Thread Alex Waygood


Change by Alex Waygood :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46172] [doc] Outdated description of `license` object

2021-12-24 Thread CCXXXI

New submission from CCXXXI :

https://docs.python.org/3/library/constants.html#license

> Object that when printed, prints the message “Type license() to see the full 
> license text”, and when called, displays the full license text in a 
> pager-like fashion (one screen at a time).

It displays "See https://www.python.org/psf/license/"; when either printed or 
called in Python 3.10.1.

--
assignee: docs@python
components: Documentation
messages: 409138
nosy: CCXXXI, docs@python
priority: normal
severity: normal
status: open
title: [doc] Outdated description of `license` object
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45865] Old syntax in unittest

2021-12-24 Thread Adam Johnson


Adam Johnson  added the comment:

Okay, I updated the PR to only remove inheritance from object. Should I reopen 
the ticket? (Not sure of the etiquette.)

Perhaps I could later submit a second patch for use of `super()`, and so on?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46171] venv module produces spurious warning that location has moved

2021-12-24 Thread layday


New submission from layday :

After 
https://github.com/python/cpython/commit/6811fdaec825bd6ab64e358a4b480108f5634d2d
the venv module produces spurious warnings for venv paths which contain
DOS-encoded parts e.g. "USER\~1" in "C:\Users\USER~1".
`tempfile.gettempdir()` returns legacy paths like these for
user temp dirs.

MRE:

python -c "import tempfile
import venv

venv.create(tempfile.mkdtemp())"
Actual environment location may have moved due to redirects, links or 
junctions.
Requested location: 
"C:\Users\RUNNER~1\AppData\Local\Temp\tmpfoobar\Scripts\python.exe"
Actual location:
"C:\Users\runneradmin\AppData\Local\Temp\tmpfoobar\Scripts\python.exe"

--
components: Library (Lib), Windows
messages: 409135
nosy: layday, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: venv module produces spurious warning that location has moved
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a9e0b2b49374df91c40fe409508cfcdc6332450e by Miss Islington (bot) 
in branch '3.10':
bpo-45878: convert `try/except` to `self.assertRaises` in 
`Lib/ctypes/test/test_functions.py` (GH-29721) (GH-29748)
https://github.com/python/cpython/commit/a9e0b2b49374df91c40fe409508cfcdc6332450e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 393ff040281db818f2d6e0240919316f58f989a6 by Miss Islington (bot) 
in branch '3.9':
bpo-45878: convert `try/except` to `self.assertRaises` in 
`Lib/ctypes/test/test_functions.py` (GH-29721) (GH-29723)
https://github.com/python/cpython/commit/393ff040281db818f2d6e0240919316f58f989a6


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46167] Parse assert (x == y, "Descriptive text") as statement params instead of a tuple

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For very long expression or very long message you can add parentheses around 
the expression or message. Black will format it as:

assert (
very very long
expression
), (
"very very long "
"message"
)

With the proposed feature it will be:

assert (
very very long
expression,
"very very long "
"message",
)

It saves one line, but the border between an expression and a message is blur. 
Since they are separated by a comma at the end of line and all lines have the 
same indentation it looks less readable to me.

Note also that Black adds a comma after message.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46150] test_pathlib assumes "fakeuser" does not exist as user

2021-12-24 Thread miss-islington


miss-islington  added the comment:


New changeset d718764f389acd1bf4a5a65661bb58862f14fb98 by Miss Islington (bot) 
in branch '3.9':
bpo-46150: ensure `fakeuser` does not exist in `PosixPathTest.test_expanduser` 
(GH-30240)
https://github.com/python/cpython/commit/d718764f389acd1bf4a5a65661bb58862f14fb98


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46150] test_pathlib assumes "fakeuser" does not exist as user

2021-12-24 Thread miss-islington


miss-islington  added the comment:


New changeset 8005e22c9c71708ead0e5b16e55e005844c5131f by Miss Islington (bot) 
in branch '3.10':
bpo-46150: ensure `fakeuser` does not exist in `PosixPathTest.test_expanduser` 
(GH-30240)
https://github.com/python/cpython/commit/8005e22c9c71708ead0e5b16e55e005844c5131f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46162] Make `builtins.property` generic

2021-12-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Does it mean that property[GetType, SetType] will be required and MyPy will 
complain if the raw property decorator be used?

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46150] test_pathlib assumes "fakeuser" does not exist as user

2021-12-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28468, 28469, 28470
pull_request: https://github.com/python/cpython/pull/30249

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46150] test_pathlib assumes "fakeuser" does not exist as user

2021-12-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28468, 28469
pull_request: https://github.com/python/cpython/pull/30249

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46150] test_pathlib assumes "fakeuser" does not exist as user

2021-12-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28468
pull_request: https://github.com/python/cpython/pull/30249

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46150] test_pathlib assumes "fakeuser" does not exist as user

2021-12-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset b8de8b7039cee47465b2af9950b0b9ed2d3f2903 by Nikita Sobolev in 
branch 'main':
bpo-46150: ensure `fakeuser` does not exist in `PosixPathTest.test_expanduser` 
(GH-30240)
https://github.com/python/cpython/commit/b8de8b7039cee47465b2af9950b0b9ed2d3f2903


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com