[issue44310] Document that lru_cache uses hard references

2021-06-13 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution: duplicate -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue44310] Document that lru_cache uses hard references

2021-06-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +25304
pull_request: https://github.com/python/cpython/pull/26716

___
Python tracker 

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



[issue44310] Document that lru_cache uses hard references

2021-06-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset fafcfff9262ae9dee03a6638dfcbcfc23a7b by Raymond Hettinger in 
branch 'main':
bpo-44310:  Note that lru_cache keep references to both arguments and results 
(GH-26715)
https://github.com/python/cpython/commit/fafcfff9262ae9dee03a6638dfcbcfc23a7b


--

___
Python tracker 

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



[issue44310] Document that lru_cache uses hard references

2021-06-13 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +25303
pull_request: https://github.com/python/cpython/pull/26715

___
Python tracker 

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



[issue44414] from __future__ import annotations breaks profiler's handling of dataclasses

2021-06-13 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-06-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> If one wants to have all NaNs in one equivalency class
> (e.g. if used as a key-value for example in pandas) it
> is almost impossible to do so in a consistent way 
> without taking a performance hit.

ISTM the performance of the equivalent class case is far less important than 
the one we were trying to solve.  Given a choice we should prefer helping 
normal unadorned instances rather than giving preference to a subclass that 
redefines the usual behaviors.  

In CPython, it is a fact of life that overriding builtin behaviors with pure 
python code always incurs a performance hit.  Also, in your example, the 
subclass isn't technically correct because it relies on a non-guaranteed 
implementation details.  It likely isn't even the fastest approach.

The only guaranteed behaviors are that math.isnan(x) reliably detects a NaN and 
that x!=x when x is a NaN.  Those are the only assured tools in the uphill 
battle to fight the weird intrinsic nature of NaNs.

So one possible solution is to replace all the NaNs with a canonical 
placeholder value that doesn't have undesired properties:

{None if isnan(x) else x for x in arr}

That relies on guaranteed behaviors and is reasonably fast.  IMO that beats 
trying to reprogram float('NaN') to behave the opposite of how it was designed.

--

___
Python tracker 

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



[issue44415] sys.stdout.flush and print() hanging

2021-06-13 Thread Rajeev Chaurasia


New submission from Rajeev Chaurasia :

I am running an application using cronjob. This application runs on 
Linux(X86_64) platform where inside a loop we have print() and 
sys.stdout.flush() statements. This loop iterates around 500 times and after 
the loop we have few more sys.stdout.flush() and print() statements. 

When I am running same application on terminal (without cronjob) then it is 
working fine.

Inside the loop everything is working fine but application is hanging after the 
loop. I put some debug statements and I found it is hanging on print() and 
sys.stdout.flush().


Code logic:-

for x in range(500):
  print(x)
  print ("something")
  sys.stdout.flush()
self.logger.info("A")
sys.stdout.flush() #1 
self.logger.info("B")
print ("Hello")#2
self.logger.info("C")
print ("Bye")  #3
self.logger.info("D")
-
"A" is getting printed in log file and nothing after that but-
If I comment #1 then I get "B" as well in the log file.
If I comment #2 then I get "C" as well in the log file
If I comment #3 then I get "D" as well in the log file.

-
ps results-
[root@scao05adm07 ~]# ps -ef|grep exachk
root 239265  98963  0 Jun11 ?00:00:00 sh /opt/oracle.ahf/bin/exachk 
-silentforce -showpass -dball -nocvu -autorun_id DEFAULT
root 239706 239265  0 Jun11 ?00:00:35 
/opt/oracle.ahf/python/bin/python /opt/oracle.ahf/exachk/exachk.py -silentforce 
-showpass -dball -nocvu -autorun_id DEFAULT
root 277938 239706  0 Jun11 ?00:00:00 sh 
/opt/oracle.ahf/exachk/exachk -silentforce -showpass -dball -nocvu -autorun_id 
DEFAULT -localonly -sudo_remoterun 0
root 278989 277938  0 Jun11 ?00:12:26 
/opt/oracle.ahf/python/bin/python /opt/oracle.ahf/exachk/exachk.py -silentforce 
-showpass -dball -nocvu -autorun_id DEFAULT -localonly -sudo_remoterun 0
root 281983 278989  0 Jun11 ?00:00:27 
/opt/oracle.ahf/python/bin/python /opt/oracle.ahf/exachk/exachk.py -silentforce 
-showpass -dball -nocvu -autorun_id DEFAULT -localonly -sudo_remoterun 0

-
# uname -a
Linux  4.14.35-1902.306.2.2.el7uek.x86_64 #2 SMP Thu Nov 19 
18:09:09 PST 2020 x86_64 x86_64 x86_64 GNU/Linux
-
I believe this issue is related to standard output buffer but I am not able to 
find a fix for it.

Please help.
-Rajeev

--
components: Library (Lib)
messages: 395772
nosy: rajeevkchaurasia
priority: normal
severity: normal
status: open
title: sys.stdout.flush and print() hanging
versions: Python 3.8

___
Python tracker 

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



[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-13 Thread Ryan Hileman


Ryan Hileman  added the comment:

> The monotonic clock should thus be based on QueryUnbiasedInterruptTime

My primary complaint here is that Windows is the only major platform with a low 
resolution monotonic clock. Using QueryUnbiasedInterruptTime() on older OS 
versions wouldn't entirely help that, so we have the same consistency issue 
(just on a smaller scale). I would personally need to still use 
time.perf_counter() instead of time.monotonic() due to this, but I'm not 
totally against it.

> For consistency, an external deadline (e.g. for SIGINT support) should work 
> the same way.

Have there been any issues filed about the deadline behaviors across system 
suspend?

> which I presume includes most users of Python 3.9+

Seems like Windows 7 may need to be considered as well, as per vstinner's 
bpo-32592 mention?

> starting with Windows 8, WaitForSingleObject() and WaitForMultipleObjects() 
> exclude time when the system is suspended

Looks like Linux (CLOCK_MONOTONIC) and macOS (mach_absolute_time()) already 
don't track suspend time in time.monotonic(). I think that's enough to suggest 
that long-term Windows shouldn't either, but I don't know how to reconcile that 
with my desire for Windows not to be the only platform with low resolution 
monotonic time by default.

> then the change to use QueryPerformanceCounter() to resolve bpo-41299 should 
> be reverted. The deadline should instead be computed with 
> QueryUnbiasedInterruptTime()

I don't agree with this, as it would regress the fix. This is more of a topic 
for bpo-41299, but I tested QueryUnbiasedInterruptTime() and it exhibits the 
same 16ms jitter as GetTickCount64() (which I expected), so non-precise 
interrupt time can't solve this issue. I do think 
QueryUnbiasedInterruptTimePrecise() would be a good fit. I think making this 
particular timeout unbiased (which would be a new behavior) should be a lower 
priority than making it not jitter.

> For Windows we could implement the following clocks:

I think that list is great and making those enums work with clock_gettime on 
Windows sounds like a very clear improvement to the timing options available. 
Having the ability to query each clock source directly would also reduce the 
impact if time.monotonic() does not perfectly suit a specific application.

---

I think my current positions after writing all of this are:

- I would probably be in support of a 3.11+ change for time.monotonic() to use 
QueryUnbiasedInterruptTime() pre-Windows 10, and dynamically use 
QueryUnbiasedInterruptTimePrecise() on Windows 10+. Ideally the Windows 
clock_gettime() code lands in the same release, so users can directly pick 
their time source if necessary. This approach also helps my goal of making 
time.monotonic()'s suspend behavior more uniform across platforms.

- Please don't revert bpo-41299 (especially the backports), as it does fix the 
issue and tracking suspend time is the same (not a regression) as the previous 
GetTickCount64() code. I think the lock timeouts should stick with QPC 
pre-Windows-10 to fix the jitter, but could use 
QueryUnbiasedInterruptTimePrecise() on Windows 10+ (which needs the same 
runtime check as the time.monotonic() change, thus could probably land in the 
same patch set).

- I'm honestly left with more questions than I started after diving into the 
GetSystemTimePreciseAsFileTime() rabbit hole. I assume it's not a catastrophic 
issue? Maybe it's a situation where adding the clock_gettime() enums would 
sufficiently help anyone who cares about the exact behavior during clock 
modification. I don't have strong opinions about it, besides it being a shame 
that Windows currently has lower precision timestamps in general. Could be 
worth doing a survey of other languages' choices, but any further discussion 
can probably go to bpo-19007.

--

___
Python tracker 

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



[issue44316] Support preserving path meaning in os.path.normpath() and abspath()

2021-06-13 Thread Eryk Sun


Eryk Sun  added the comment:

I think separate keep_curdir and keep_pardir options is over-complicating the 
signature. Also, I'd prefer to remove a dot component if it's not the first 
component since there's no reason to keep it.

If you plan to use normpath() in pathlib, then the case for special_prefixes in 
ntpath.normpath() should be removed. Actually, it never should have been added. 
IIRC it was added as a workaround for a buggy implementation that's no longer 
an issue. Only \\?\ is special, and that's only when opening/accessing a path. 
It's not special in GetFullPathNameW(), as is called by ntpath.abspath() in 
Windows. This needlessly introduces inconsistency for ntpath.abspath() calls in 
Windows vs Unix.

--

___
Python tracker 

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



[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-13 Thread Eryk Sun


Eryk Sun  added the comment:

On second thought, starting with Windows 8, WaitForSingleObject() and 
WaitForMultipleObjects() exclude time when the system is suspended. For 
consistency, an external deadline (e.g. for SIGINT support) should work the 
same way. The monotonic clock should thus be based on 
QueryUnbiasedInterruptTime(). We can conditionally use 
QueryUnbiasedInterruptTimePrecise() in Windows 10, which I presume includes 
most users of Python 3.9+ on Windows since Windows 8.1 only has a 3% share of 
desktop/laptop systems.

If we can agree on the above, then the change to use QueryPerformanceCounter() 
to resolve bpo-41299 should be reverted. The deadline should instead be 
computed with QueryUnbiasedInterruptTime(). It's limited to the resolution of 
the system interrupt time, but at least compared to GetTickCount64() it returns 
the real interrupt time instead of an idealized 64 ticks/second.

> expose all of the Windows clocks directly (through clock_gettime enums?)

_Py_clock_gettime() and _Py_clock_getres() could be implemented in 
Python/pytime.c. For Windows we could implement the following clocks:

CLOCK_REALTIMEGetSystemTimePreciseAsFileTime
CLOCK_REALTIME_COARSE GetSystemTimeAsFileTime
CLOCK_MONOTONIC_COARSEQueryUnbiasedInterruptTime
CLOCK_PROCESS_CPUTIME_ID  GetProcessTimes
CLOCK_THREAD_CPUTIME_ID   GetThreadTimes
CLOCK_PERF_COUNTERQueryPerformanceCounter

Windows 10+
CLOCK_MONOTONIC   QueryUnbiasedInterruptTimePrecise
CLOCK_BOOTTIMEQueryInterruptTimePrecise
CLOCK_BOOTTIME_COARSE QueryInterruptTime

> it may also be worth replacing time.time()'s GetSystemTimeAsFileTime with 
> GetSystemTimePreciseAsFileTime

See bpo-19007, which is nearly 8 years old.

--

___
Python tracker 

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



[issue43425] test_peg_generator.test_c_parser emits DeprecationWarning due to distutils

2021-06-13 Thread miss-islington


miss-islington  added the comment:


New changeset 2b57ad3f5382edb6fe2dfe3c721573fbf25a826f by Miss Islington (bot) 
in branch '3.10':
bpo-43425: Update test_c_parser not to use TempdirManager (GH-26693)
https://github.com/python/cpython/commit/2b57ad3f5382edb6fe2dfe3c721573fbf25a826f


--

___
Python tracker 

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



[issue44405] add program passed as string to dis module.

2021-06-13 Thread Arjun


Change by Arjun :


--
pull_requests: +25302
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26714

___
Python tracker 

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



[issue43425] test_peg_generator.test_c_parser emits DeprecationWarning due to distutils

2021-06-13 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue19007] precise time.time() under Windows 8: use GetSystemTimePreciseAsFileTime

2021-06-13 Thread Eryk Sun


Eryk Sun  added the comment:

> What are the expected benefits from changing? Just a higher 
> resolution? I'm not sure that's worth anything if it's inaccurate.

GetSystemTimePreciseAsFileTime() returns an accurate timestamp, which is the 
current system time plus the difference between the current value of the 
performance counter and its value when the system time was last updated. This 
can't be replicated simply with separate calls to GetSystemTimeAsFileTime() and 
QueryPerformanceCounter(). It relies on the following undocumented fields in 
the KUSER_SHARED_DATA record: BaselineSystemTimeQpc, QpcSystemTimeIncrement, 
and QpcSystemTimeIncrementShift. 

The system uses a similar procedure in QueryInterruptTimePrecise() to extend 
the precision of QueryInterruptTime(). Ditto for QueryUnbiasedInterruptTime() 
vs QueryUnbiasedInterruptTimePrecise().

> "GetSystemTimePreciseAsFileTime() has very little overhead; the new 
> function is even a little faster than GetSystemTimeAsFileTime(), a 
> call takes a few ten nanoseconds."

The above claim was corrected back in 2014. GetSystemTimePreciseAsFileTime() is 
considerably more expensive than GetSystemTimeAsFileTime(). It costs about 10 
times more on a system that supports an invariant TSC. It would be more 
expensive on an older system that use the chipset's HPET or ACPI PM timer. That 
said, I doubt this matters very much when calling time.time() in interpreted 
code. It's a difference measured in tens of nanoseconds.

--
nosy: +eryksun
versions: +Python 3.11 -Python 3.6

___
Python tracker 

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



[issue22234] urllib.parse.urlparse accepts any falsy value as an url

2021-06-13 Thread Jacob Walls


Jacob Walls  added the comment:

Well, now I've looked at the CPython test failure more closely, and it's in 
`test.test_venv.EnsurePipTest` where we just download latest pip. 

Their release cadence suggests a new release in July, about 2-4 weeks from now. 
So I'll wait on adding the DeprecationWarning for passing `None` unless folks 
ask for it during review, and am happy to wait a few weeks for green CI.

--

___
Python tracker 

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



[issue22234] urllib.parse.urlparse accepts any falsy value as an url

2021-06-13 Thread Jacob Walls


Jacob Walls  added the comment:

Both this ticket and #19094 started from one method in urllib.parse and then 
generalized a proposal for the rest of the submodule to move away from 
duck-typing and to instead raise TypeErrors (or at least some error) for 
invalid types. The attached PR does that. But it broke pip, which was passing 
None to the `fragment` argument of `urlunsplit()`.

In a blaze of efficiency, Pip already merged my fix, but since the CPython test 
suite depends on the current version of pip -- perhaps there's an argument for 
at least raising a deprecation warning for ``None`` and then converting to '' 
or b''? In any case, green CI makes patches more reviewable, so I'm inclined to 
add such a warning/conversion for now and then see how feedback goes. Cheers, 
all.

BTW: perhaps we can close this as dupe of #19094?

--

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +3.10regression, 3.9regression -patch

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +25300
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26712

___
Python tracker 

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2021-06-13 Thread STINNER Victor


STINNER Victor  added the comment:

> The codecs api feels extremely well-fitting for integrating iconv in python 
> and any alternative I can think of seems unsatisfactory.

This issue is now closed, would you mind to open a new issue?

--

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Well, in both cases this means that the line number is not available. I think 
None is a bit cleaner in this regard.

--

___
Python tracker 

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



[issue44414] from __future__ import annotations breaks profiler's handling of dataclasses

2021-06-13 Thread James Wilcox


New submission from James Wilcox :

This program behaves differently when run under the profiler (either profile or 
cProfile) versus when run normally.

```
from __future__ import annotations  # ***
import dataclasses

@dataclasses.dataclass
class C:
x: dataclasses.InitVar[int]

def __post_init__(self, x):
print(f'hello {x}')

C(0)
```

Save this as foo.py. Then

python foo.py

prints

hello 0

but

python -m profile foo.py

results in the traceback

```
Traceback (most recent call last):
  File "/Users/jrw12/.pyenv/versions/3.9.5/lib/python3.9/runpy.py", line 197, 
in _run_module_as_main
return _run_code(code, main_globals, None,
  File "/Users/jrw12/.pyenv/versions/3.9.5/lib/python3.9/runpy.py", line 87, in 
_run_code
exec(code, run_globals)
  File "/Users/jrw12/.pyenv/versions/3.9.5/lib/python3.9/profile.py", line 610, 
in 
main()
  File "/Users/jrw12/.pyenv/versions/3.9.5/lib/python3.9/profile.py", line 599, 
in main
runctx(code, globs, None, options.outfile, options.sort)
  File "/Users/jrw12/.pyenv/versions/3.9.5/lib/python3.9/profile.py", line 99, 
in runctx
return _Utils(Profile).runctx(statement, globals, locals, filename, sort)
  File "/Users/jrw12/.pyenv/versions/3.9.5/lib/python3.9/profile.py", line 62, 
in runctx
prof.runctx(statement, globals, locals)
  File "/Users/jrw12/.pyenv/versions/3.9.5/lib/python3.9/profile.py", line 422, 
in runctx
exec(cmd, globals, locals)
  File "foo.py", line 11, in 
C(0)
  File "", line 4, in __init__
TypeError: __post_init__() missing 1 required positional argument: 'x'
```

A similar traceback occurs if using `-m cProfile` instead of `-m profile`.

No such traceback occurs if the `from future import __annotations__` is removed 
from the file.

Possibly related to #39442.

--
components: Library (Lib)
messages: 395762
nosy: wilcoxjay
priority: normal
severity: normal
status: open
title: from __future__ import annotations breaks profiler's handling of 
dataclasses
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue44388] venv API Docs for EnvBuilder.ensure_directories incorrectly describe behavior

2021-06-13 Thread Ned Deily


Change by Ned Deily :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue44386] importlib and math.pi interact strangely

2021-06-13 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-06-13 Thread realead


realead  added the comment:

@mark.dickinson

> ...my expectation was that there would be few cases of breakage, and that for 
> those few cases it shouldn't be difficult to fix the breakage.

This expectation is probably correct.

My issue is somewhat only partly on-topic here: If one wants to have all NaNs 
in one equivalency class (e.g. if used as a key-value for example in pandas) it 
is almost impossible to do so in a consistent way without taking a performance 
hit. It seems to be possible builtin-types (even if frozenset won't be pretty), 
but already something like


class A:
def __init__(self, a):
self.a=a
def __hash__(self):
return hash(self.a)
def __eq__(self, other):
return self.a == other.a

is not easy to handle.

A special comparator for containers would be an ultimative solution, but I see 
how this could be too much hassle for a corner case.

--

___
Python tracker 

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



[issue44399] log rotator cookbook example might waste disk space

2021-06-13 Thread Vinay Sajip


Vinay Sajip  added the comment:

> But I understand if this is out of scope.

I think it's out of scope here (as discussion of such issues will obscure the 
basic point about how to use the namer and rotator).

However, it might be useful to have a "gotchas" section somewhere in the 
logging docs called something like "Things to be careful about", 
"Anti-patterns", "Patterns to Avoid" or similar. Or maybe have it in the 
cookbook with a section at the end - "Recipes to Avoid".

--

___
Python tracker 

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



[issue44136] Remove pathlib flavours

2021-06-13 Thread Barney Gale


Barney Gale  added the comment:

Depends: bpo-39899, bpo-43757, bpo-44316, bpo-44403, bpo-44412

--

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-06-13 Thread Vyacheslav


New submission from Vyacheslav :

date_str = "2019-06-06 10:02:00"
datetime_obj = datetime.strptime(date_str, "%Y-%m-%d %H:%M:%S")
datetime_obj_utc1 = 
datetime_obj.replace(tzinfo=pytz.timezone("America/New_York"))
datetime_obj_utc2 = pytz.timezone("America/New_York").localize(datetime_obj)
print(datetime_obj_utc1, datetime_obj_utc2)
ts1 = time.mktime(datetime_obj_utc1.timetuple())
ts2 = time.mktime(datetime_obj_utc2.timetuple())

>>> Output:
ts2 = int(time.mktime(datetime_obj_utc2.timetuple()))
OverflowError: mktime argument out of range


OS: Linux OpenSuse TW

--
messages: 395758
nosy: psijic
priority: normal
severity: normal
status: open
title: OverflowError: mktime argument out of range after 2019
type: crash
versions: Python 3.8

___
Python tracker 

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



[issue44269] smtplib AUTH command doesn't handle EAI arguments

2021-06-13 Thread John L


Change by John L :


--
keywords: +patch
pull_requests: +25299
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26709

___
Python tracker 

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



[issue44412] Add os.path.fileuri() function

2021-06-13 Thread Barney Gale


Change by Barney Gale :


--
keywords: +patch
pull_requests: +25296
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26708

___
Python tracker 

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



[issue44136] Remove pathlib flavours

2021-06-13 Thread Barney Gale


Change by Barney Gale :


--
pull_requests: +25297
pull_request: https://github.com/python/cpython/pull/26708

___
Python tracker 

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



[issue24132] Direct sub-classing of pathlib.Path

2021-06-13 Thread Barney Gale


Change by Barney Gale :


--
pull_requests: +25298
pull_request: https://github.com/python/cpython/pull/26708

___
Python tracker 

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



[issue44399] log rotator cookbook example might waste disk space

2021-06-13 Thread mori-b


mori-b  added the comment:

Indeed this situation would rise only under misusage of the log, where multiple 
processes inherit by  mistake or by wrong design a file descriptor of a same 
log file (Regarding the threads case I unfortunately cannot reproduce).
While this kind of misusage doesn't have terrible consequences when not using 
the rotator, the growing used disk space which occurs when using the rotator is 
more serious, that's why I found appropriate to try and protect the programmer 
from his own mistake. But I understand if this is out of scope.

--

___
Python tracker 

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



[issue44412] Add os.path.fileuri() function

2021-06-13 Thread Barney Gale


New submission from Barney Gale :

Proposal:

- Introduce `os.path.fileuri()` function that produces a 'file://' URI
- Adjust `PurePosixPath.to_uri()` to call `posixpath.fileuri()`
- Adjust `PureWindowsPath.to_uri()` to call `ntpath.fileuri()`
- Adjust `nturl2path.pathname2url()` to call `ntpath.fileuri()`

Rationale:

- pathlib is 95% a wrapper around `os` and `os.path`. It implements
  little itself except the OOP interface. `as_uri()` is one of only a
  tiny handful of pathlib features that have no decent antecedents.
- the existence of these OS-specific features complicates pathlib's
  internals, necessitating the existence of OS-specific '_Flavour'
  classes that greatly complicate work on bpo-24132
- this is a useful feature with lots of stackoverflow posts. It seems
  silly to /require/ users to use pathlib for this, as the rest of their
  codebase may work just fine using traditional path manip.

Further discussion on python-ideas: 
https://discuss.python.org/t/pathlib-and-os-path-feature-parity-and-code-de-duplication/9239

Related: bpo-44403, bpo-44136, bpo-24132

--
components: Library (Lib)
messages: 395756
nosy: barneygale
priority: normal
severity: normal
status: open
title: Add os.path.fileuri() function
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



[issue42998] pathlib.Path: add `username` argument to `home()`

2021-06-13 Thread Barney Gale


Barney Gale  added the comment:

Per discussion, expanduser('~other') is considered unreliable, and we shouldn't 
add new functions that call through to it. Resolving as 'rejected'.

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue39950] Add pathlib.Path.hardlink_to()

2021-06-13 Thread Barney Gale


Change by Barney Gale :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue37880] For argparse add_argument with action='store_const', const should default to None.

2021-06-13 Thread Jack DeVries


Change by Jack DeVries :


--
keywords: +patch
pull_requests: +25294
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26707

___
Python tracker 

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



[issue44411] regrtests fail with segfault after failing calls to malloc

2021-06-13 Thread Jack DeVries


Change by Jack DeVries :


--
keywords: +patch
pull_requests: +25295
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26707

___
Python tracker 

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



[issue44411] regrtests fail with segfault after failing calls to malloc

2021-06-13 Thread Jack DeVries


Change by Jack DeVries :


--
components: +Library (Lib), macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue44411] regrtests fail with segfault after failing calls to malloc

2021-06-13 Thread Jack DeVries

New submission from Jack DeVries :

When running regrtests via `./python.exe -m test` on my system, several 
warnings about failing calls to malloc are generated during `test_decorators`. 
Then, a segmentation fault happens shortly thereafter in `test_descrtut`.

The most recent commit on the main branch as of this test run was 
17b16e13bb444001534ed6fccb459084596c8bcf.

Here are some details about my system:

Model Name: MacBook Pro
  Model Identifier: MacBookPro12,1
  Processor Name:   Dual-Core Intel Core i5
  Processor Speed:  2.7 GHz
  Number of Processors: 1
  Total Number of Cores:2
  L2 Cache (per Core):  256 KB
  L3 Cache: 3 MB
  Hyper-Threading Technology:   Enabled
  Memory:   8 GB
  System Firmware Version:  427.0.0.0.0
  SMC Version (system): 2.28f7
  Serial Number (system):   C02P9EMTFVH5
  Hardware UUID:ABA9DB61-5A93-54BC-8057-6F0E0DA6544B
  Provisioning UDID:ABA9DB61-5A93-54BC-8057-6F0E0DA6544B



Here is the full output from cloning all the way down to segfault
=


➜  tmp.kw3WJpEs git clone g...@github.com:python/cpython.git . --depth=1
Cloning into '.'...
remote: Enumerating objects: 4779, done.
remote: Counting objects: 100% (4779/4779), done.
remote: Compressing objects: 100% (4362/4362), done.
remote: Total 4779 (delta 488), reused 1570 (delta 314), pack-reused 0
Receiving objects: 100% (4779/4779), 24.71 MiB | 11.00 MiB/s, done.
Resolving deltas: 100% (488/488), done.
Updating files: 100% (4537/4537), done.
➜  tmp.kw3WJpEs git:(main) ./configure --with-pydebug
checking for git... found
checking build system type... x86_64-apple-darwin20.5.0
checking host system type... x86_64-apple-darwin20.5.0
checking for python3.11... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "darwin"
Configured with: --prefix=/Library/Developer/CommandLineTools/usr 
--with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for a sed that does not truncate output... /usr/bin/sed
checking for --with-cxx-main=... no
checking for g++... no
configure:

  By default, distutils will build C++ extension modules with "g++".
  If this is not intended, then set CXX on the configure command line.
  
checking for the platform triplet based on compiler characteristics... darwin
checking for -Wl,--no-as-needed... no
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for the Android API level... not Android
checking for --with-suffix... 
checking for case-insensitive build directory... yes
checking LIBRARY... libpython$(VERSION)$(ABIFLAGS).a
checking LINKCC... $(PURIFY) $(MAINCC)
checking EXPORTSYMS... 
checking for GNU ld... no
checking for --enable-shared... no
checking for --enable-profiling... no
checking LDLIBRARY... libpython$(VERSION)$(ABIFLAGS).a
checking for ar... ar
checking for readelf... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for --with-pydebug... yes
checking for --with-trace-refs... no
checking for --with-assertions... implied by --with-pydebug
checking for --enable-optimizations... no
checking PROFILE_TASK... -m test --pgo --timeout=$(TESTTIMEOUT)
checking for --with-lto... no
checking for llvm-profdata... no
configure: llvm-profdata found via xcrun: /usr/bin/xcrun llvm-profdata
checking for -Wextra... yes
checking whether gcc accepts and needs -fno-strict-aliasing... no
checking if we can turn off gcc unused result warning... yes
checking if we can turn off gcc unused parameter warning... yes
checking if we can turn off gcc missing field initializers warning... yes
checking if we can turn on gcc mixed sign comparison warning... yes
checking if we can turn on gcc unreachable code warning... no
checking if we can turn on gcc strict-prototypes warning... yes
checking if we can make implicit 

[issue22334] test_tcl.test_split() fails on "x86 FreeBSD 7.2 3.x" buildbot

2021-06-13 Thread Jacob Walls


Change by Jacob Walls :


--
nosy:  -jacobtylerwalls

___
Python tracker 

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



[issue22334] test_tcl.test_split() fails on "x86 FreeBSD 7.2 3.x" buildbot

2021-06-13 Thread Jacob Walls


Jacob Walls  added the comment:

Sorry for noise; I typo-d when linking a PR on GitHub. Unlinked.

--

___
Python tracker 

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



[issue22334] test_tcl.test_split() fails on "x86 FreeBSD 7.2 3.x" buildbot

2021-06-13 Thread Jacob Walls


Change by Jacob Walls :


--
pull_requests:  -25293

___
Python tracker 

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



[issue22334] test_tcl.test_split() fails on "x86 FreeBSD 7.2 3.x" buildbot

2021-06-13 Thread Jacob Walls


Change by Jacob Walls :


--
nosy: +jacobtylerwalls
nosy_count: 5.0 -> 6.0
pull_requests: +25293
pull_request: https://github.com/python/cpython/pull/26687

___
Python tracker 

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



[issue44410] Exception in AsyncMock side_effect cases incorrect refcount

2021-06-13 Thread Daniel Andersson


New submission from Daniel Andersson :

Dear maintainers,

I discovered an unexpected behavior when the `side_effect` of an `AsyncMock` 
includes an exception. The test case below fails but I expected it to pass:

```
import sys
import unittest
from unittest.mock import AsyncMock


class A:
async def foobar(self):
while True:
try:
return await self.mock()
except Exception:
continue


class TestA(unittest.IsolatedAsyncioTestCase):
async def test_refcount(self):
a = A()
a.mock = AsyncMock(side_effect=[Exception(), None])
refc = sys.getrefcount(a)
await a.foobar()
self.assertEqual(refc, sys.getrefcount(a))


if __name__ == "__main__":
unittest.main()
```

If `side_effect=[Exception(), None]` is changed to `side_effect=[None, None]` 
the test case pass.

I discovered this in a bigger codebase while debugging why a weakref.finalize 
did not trigger as expected.

--
components: asyncio
messages: 395752
nosy: asvetlov, penlect, yselivanov
priority: normal
severity: normal
status: open
title: Exception in AsyncMock side_effect cases incorrect refcount
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue44399] log rotator cookbook example might waste disk space

2021-06-13 Thread Vinay Sajip


Vinay Sajip  added the comment:

The cookbook example is (by design) limited in scope and doesn't especially 
discuss usage in multi-thread or multi-process scenarios - as with other 
examples in the cookbook which aren't specifically concerned with such 
scenarios. I don't think this is a problem with the example.

The problem occurs because on POSIX-style platforms, you can have multiple 
sources pointing to a file, and if deleted it only actually disappears when 
there are no references to it (such as open file descriptors/handles in other 
threads/processes). On Windows, for example, you would typically get a "sharing 
violation" type of error because you can't have multiple concurrent writers to 
a given file. This is not specifically a logging issue, as you could get the 
same thing happening with other kinds of files shared between processes and/or 
threads.

Adding os.truncate() might just serve to hide the problem for a while, but the 
right answer is to avoid opening the same log file multiple times. In the 
examples you mention, do multiple threads create handlers pointing to the same 
file? That might be an anti-pattern. Normally, the main thread configures 
logging (early in the "if __name__ == '__main__'" clause which creates the 
relevant handlers) and then any subsequently created threads just log to their 
loggers, but don't create any new handlers in the thread.

--

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-06-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Does this change need to be mentioned in What's New?

--

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-06-13 Thread miss-islington


miss-islington  added the comment:


New changeset 128899d8b8d65d86bd9bbea6801e9f36e6f409f2 by Miss Islington (bot) 
in branch '3.10':
bpo-43475: Fix the Python implementation of hash of Decimal NaN (GH-26679)
https://github.com/python/cpython/commit/128899d8b8d65d86bd9bbea6801e9f36e6f409f2


--

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-06-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> Maybe a new comparator is called for (like PY_EQ_FOR_HASH_COLLECTION), which 
> would yield float("nan") equivalent to float("nan") and which should be used 
> in hash-set/dict?

It is difficult to do from technical point of view because all rich comparison 
implementations support currently only 6 operations. If you call tp_richcomp 
with something else it will crash. So we need to add new slot tp_richcomp_ex 
and complex logic to call either tp_richcomp_ex or tp_richcomp and correctly 
handle inheritance. It is too high bar.

> Does GH-26679 need to be backported to the 3.10 branch?

I thought that the original change was 3.11 only, but seems it was merged 
before the split of the 3.10 branch. So PR 26679 needs to be backported. I 
would add a NEWS entry if I knew this.

--
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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-06-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +25292
pull_request: https://github.com/python/cpython/pull/26706

___
Python tracker 

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



[issue22234] urllib.parse.urlparse accepts any falsy value as an url

2021-06-13 Thread Jacob Walls


Change by Jacob Walls :


--
nosy: +jacobtylerwalls
nosy_count: 7.0 -> 8.0
pull_requests: +25291
pull_request: https://github.com/python/cpython/pull/26687

___
Python tracker 

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



[issue16845] warnings.simplefilter should validate input

2021-06-13 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@Bonifacio2, As commented on the PR, I think opening a PR with a patch close to 
what @berker.peksag suggested looks more elaborate, IMHO.

Thanks for your contribution.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-06-13 Thread Mark Dickinson


Mark Dickinson  added the comment:

@Serhiy: can this be closed again? Does GH-26679 need to be backported to the 
3.10 branch?

--

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-06-13 Thread Mark Dickinson


Mark Dickinson  added the comment:

@realead

> This change makes life harder for people trying to get sane behavior with 
> sets [...]

Yes, code that assumes that all NaNs have the same hash value will need to 
change. But that doesn't seem unreasonable for objects that are already 
considered distinct with respect to the containment equivalence relation ("is" 
followed by "=="). I think this change was the right one to make, and my 
expectation was that there would be few cases of breakage, and that for those 
few cases it shouldn't be difficult to fix the breakage. If that's not true 
(either there are lots of cases of breakage, or the breakage is hard to fix), 
perhaps we should reconsider. I haven't yet seen evidence that either of those 
things is true, though.

> Maybe a new comparator is called for [...]

Agreed that that seems like a possible technical solution: Python could add a 
new special method __container_eq__ which is required to provide (at the least) 
a reflexive and symmetric relation, and whose default implementation does the 
same is-followed-by-== check that's already used for list, dict and set 
containment. For what it's worth, this is close to the approach that Julia 
takes: they have an "is_equal" function that's mostly the same as the normal 
equality == but differs for NaNs (and incidentally for signed zeros). But 
whether this would make sense from a language design perspective is another 
matter, and it would be a significant language-level change (certainly 
requiring a PEP). It feels like an enormous conceptual change to introduce to 
the language just to deal with the annoyance of NaNs. And that really is all it 
would be good for, unless perhaps it also provides a solution to the problem of 
NumPy arrays in containers, again caused by NumPy arrays overriding __eq__ in a
  nonstandard way.

--

___
Python tracker 

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



[issue44389] Modules/_ssl.c, repeated 'SSL_OP_NO_TLSv1_2'

2021-06-13 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Thanks, Christian.

--

___
Python tracker 

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



[issue44389] Modules/_ssl.c, repeated 'SSL_OP_NO_TLSv1_2'

2021-06-13 Thread Christian Heimes


Change by Christian Heimes :


--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue44389] Modules/_ssl.c, repeated 'SSL_OP_NO_TLSv1_2'

2021-06-13 Thread miss-islington


miss-islington  added the comment:


New changeset 4becc569a606102bce624a4e28f4068317d09f42 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-44389: Fix deprecation of OP_NO_TLSv1_3 (GH-26700) (GH-26705)
https://github.com/python/cpython/commit/4becc569a606102bce624a4e28f4068317d09f42


--

___
Python tracker 

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



[issue44389] Modules/_ssl.c, repeated 'SSL_OP_NO_TLSv1_2'

2021-06-13 Thread Christian Heimes


Christian Heimes  added the comment:

OpenSSL has deprecated these constants:

> SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2, 
> SSL_OP_NO_TLSv1_3, SSL_OP_NO_DTLSv1, SSL_OP_NO_DTLSv1_2
>
> As of OpenSSL 1.1.0, these options are deprecated, use 
> SSL_CTX_set_min_proto_version(3) and SSL_CTX_set_max_proto_version(3) instead.

https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_options.html

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue44389] Modules/_ssl.c, repeated 'SSL_OP_NO_TLSv1_2'

2021-06-13 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset bf527277d4e4907e32d76ca7ba667ab3149fe258 by Christian Heimes in 
branch 'main':
bpo-44389: Fix deprecation of OP_NO_TLSv1_3 (GH-26700)
https://github.com/python/cpython/commit/bf527277d4e4907e32d76ca7ba667ab3149fe258


--

___
Python tracker 

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



[issue44389] Modules/_ssl.c, repeated 'SSL_OP_NO_TLSv1_2'

2021-06-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25290
pull_request: https://github.com/python/cpython/pull/26705

___
Python tracker 

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



[issue44409] compile raises SyntaxError with undocumented lineno attribute None

2021-06-13 Thread Florian Weimer


New submission from Florian Weimer :

This example results in an undocumented value None for the lineno attribute:

```
source = b"\xef\xbb\xbf#coding: utf8\nprint('\xe6\x88\x91')\n"

try:
compile(source, filename="example.py", mode="exec")
except SyntaxError as e:
print(str(e))
print(type(e.lineno))
```

Output:

```
encoding problem: utf8 with BOM

```

Seen with python3-3.9.5-2.fc33.x86_64.

python3-3.8.10-1.fc32.x86_64 used a lineno value of 0 (type int).

--
components: Parser
messages: 395740
nosy: fweimer, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: compile raises SyntaxError with undocumented lineno attribute None
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue44389] Modules/_ssl.c, repeated 'SSL_OP_NO_TLSv1_2'

2021-06-13 Thread miss-islington


miss-islington  added the comment:


New changeset f30f484e9660c6ad5d5a554869593d14d709a7f4 by Miss Islington (bot) 
in branch '3.10':
bpo-44389: Remove duplicate SSL_OP_NO_TLSv1_2 flag (GH-26680)
https://github.com/python/cpython/commit/f30f484e9660c6ad5d5a554869593d14d709a7f4


--

___
Python tracker 

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



[issue44389] Modules/_ssl.c, repeated 'SSL_OP_NO_TLSv1_2'

2021-06-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +25289
pull_request: https://github.com/python/cpython/pull/26704

___
Python tracker 

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



[issue44283] Add jump table for certain safe match-case statements

2021-06-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> How common match-case statements with literal integers? 

Nothing is common yet because the feature hasn't been released ;-)

I suspect that if match-case were optimized for integer constants, they would 
be used.  In discussions about case statements, there are two groups, one 
looking for a prettier if-elif-else chain and the other looking for a fast 
vectored jump.  This optimization is aimed at the latter group -- they would be 
happy to have this opportunity to make faster code, even if it means using 
integer constants.

--

___
Python tracker 

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



[issue44370] Inconsistent results for min() and max() with math.nan as argument

2021-06-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Maybe add two key functions for making NaN either the smallest
> or the largest number?

SQL does this with NULLS FIRST or NULLS LAST but it is a nuisance.  I think it 
better to opt for simplicity and choose a default.

--

___
Python tracker 

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



[issue44370] Inconsistent results for min() and max() with math.nan as argument

2021-06-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> There's also a somewhat arbitrary choice to be made here: 
> do we consider NaNs to be negative or positive?
>  That is, do we want NaNs to sort to the beginning of the 
> list, or the end?

I had suggested putting NaNs at the beginning because that is how None was 
sorted in Python 2.  But that doesn't really need to be a guide.  Likely the 
best choice is to follow numpy's decision, placing NaNs at the end.

--

___
Python tracker 

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



[issue44399] log rotator cookbook example might waste disk space

2021-06-13 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> vinay.sajip
nosy: +vinay.sajip

___
Python tracker 

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



[issue44404] tkinter's after() AttributeError with functools.partial (no attribute __name__)

2021-06-13 Thread E. Paine


E. Paine  added the comment:

Reproducible in Python 3.9. The issue occurs because functools.partial is a 
class, not function. I believe the fix is simply something like:

try:
callit.__name__ = func.__name__
except AttributeError:
callit.__name__ = type(func).__name__

This will use the name 'partial'. The lack of '__name__' is noted in the 
functools docs so I agree with Philip that this is an issue with tkinter. 
Philip, do you want to open a pull request for this?

It should be noted that functools.partial is not required in this situation as 
'after' takes arguments for the function call:
r.after(500, print, "lol")

--
nosy: +epaine, serhiy.storchaka
versions: +Python 3.10, Python 3.11

___
Python tracker 

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



[issue44406] Divergent sys.prefix behavior causes `python -m build` command to fail when in virtual environment

2021-06-13 Thread Paul Moore


Paul Moore  added the comment:

I don't inderstand what "discrepancy" you mean here. The documentation you 
quote explains the behaviour, and I don't see the problem.

If build is failing, why do you not think that is a bug in build? I can only 
see one call to venv.EnvBuilder in the code you mention and it looks correct. 
What error are you seeing?

--

___
Python tracker 

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



[issue44400] Propose random.randbool()

2021-06-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I would like to get opinions from Raymond and then 
> proceed with this issue.

I concur with Steven and Serhiy and don't think this should be added.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44283] Add jump table for certain safe match-case statements

2021-06-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

How common match-case statements with literal integers? I expect that in most 
cases such magic numbers are not used directly, but as named constants.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44405] add program passed as string to dis module.

2021-06-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I often use the command-line interface of dis, ast, and sometimes tokenize 
modules. They are mature enough and not only for self-testing. If they are not 
documented, we need to document them.

Since they read from stdin by default (no need to specify /dev/stdin or CON 
explicitly) I never needed the -c option. It would not be particularly useful 
in any case because Python code is usually multi-line.

BTW sometimes I want to implement GUI for these modules in IDLE.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue36027] Support negative exponents in pow() where a modulus is specified.

2021-06-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 10.0 -> 11.0
pull_requests: +25288
pull_request: https://github.com/python/cpython/pull/26702

___
Python tracker 

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



[issue36027] Support negative exponents in pow() where a modulus is specified.

2021-06-13 Thread Mark Dickinson


Change by Mark Dickinson :


--
pull_requests: +25287
pull_request: https://github.com/python/cpython/pull/26703

___
Python tracker 

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



[issue37751] In codecs, function 'normalizestring' should convert both spaces and hyphens to underscores.

2021-06-13 Thread Bodo Graumann

Bodo Graumann  added the comment:

Unfortunately this is not quite finished yet.

First of all, the change is bigger than what is documented: “Changed in version 
3.9: Hyphens and spaces are converted to underscore.“

In reality, now
| Normalization works as follows: all non-alphanumeric
| characters except the dot used for Python package names are
| collapsed and replaced with a single underscore, e.g. '  -;#'
| becomes '_'. Leading and trailing underscores are removed.”
Cf. 
[encodings/__init__.py](https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Lib/encodings/__init__.py#L47-L50)

Secondly, this change breaks lots of iconv codecs with the python-iconv 
binding. E.g. `ASCII//TRANSLIT` is now normalized to `ascii_translit`, which 
iconv does not understand. Codec names which use hyphens also break and iinm 
not all of them have aliases in iconv without hyphens.
Cf. [python-iconv #4](https://github.com/bodograumann/python-iconv/issues/4)

The codecs api feels extremely well-fitting for integrating iconv in python and 
any alternative I can think of seems unsatisfactory.
Please advise.

--
nosy: +bodograumann

___
Python tracker 

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