[issue42711] lru_cache and NotImplemented

2020-12-21 Thread Kaleb Barrett


New submission from Kaleb Barrett :

Having to return `NotImplemented` (which counts as a successful function call) 
in `functools.lru_cache` and `functools.cache` decorated binary dunder methods 
has the potential to fill the LRU cache with calls that will in ultimately 
result in errors (read "garbage").

There are a few ways to avoid this IMO:

1. Change `functools.lru_cache` not cache calls that result in `NotImplemented`.
2. Allow a user to easily extend `functools.lru_cache` (the implementation is 
not extensible right now) to do the previously mentioned operation.
3. Add the ability to *throw* `NotImplemented` in binary dunder methods so the 
function call does not complete. This would work exactly like returning 
`NotImplemented` and be handled by the runtime.

And my current solution...

4. Copy-paste `functools.lru_cache` and add in changes for solution 1 :)

--
components: Library (Lib)
messages: 383573
nosy: ktbarrett
priority: normal
severity: normal
status: open
title: lru_cache and NotImplemented
type: performance
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue35728] Tkinter font nametofont requires default root

2020-12-21 Thread Desmond Cheong


Change by Desmond Cheong :


--
keywords: +patch
nosy: +desmondcheongzx
nosy_count: 2.0 -> 3.0
pull_requests: +22744
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23885

___
Python tracker 

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



[issue42709] I

2020-12-21 Thread Tim Peters


Tim Peters  added the comment:

It appears to be spam: the title is the single letter "I", and there's not a 
single word of text. There was nothing sensible to be done _except_ to close it 
:-)

--
nosy: +tim.peters

___
Python tracker 

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



[issue42709] I

2020-12-21 Thread James B Wilkinson

New submission from James B Wilkinson :

> On Dec 21, 2020, at 11:11 PM, Raymond Hettinger  
> wrote:
> 
> 
> Change by Raymond Hettinger :
> 
> 
> --
> stage:  -> resolved
> status: open -> closed

I see that this has been marked “resolved” and closed with no hint as to what 
the problem is.

Did I do something wrong by submitting this? If so I apologize.

thanks

James B. Wilkinson
Professor Emeritus
Department of Computer Science
The College of Charleston

the@twc.com

--

___
Python tracker 

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



[issue42710] Viewing pydoc API documentation

2020-12-21 Thread Faris Chugthai


New submission from Faris Chugthai :

I'm sure that this has been observed before, but I was unable to find the 
original issue where this was discussed so I'm going to apologize in advance 
for what is probably a duplicate issue.

But why is there no documentation available on the classes and functions 
available in the pydoc module?

There are a large number of well documented classes, methods and functions and 
I could easily imagine legitimate motivations to want to import some of the 
functionality provided and use it in a project.

No information on the 2000 lines of code in pydoc.py are provided at 
https://docs.python.org/3/library/pydoc.html

Running:

`python -m pydoc -w pydoc`

Generates a similarly sparse file.

In addition, running in the interactive interpreter:

>>> help(pydoc)

shows almost no real information. I'm genuinely unsure of why this happens. 
Even if this is an intentional design decision for how the Helper class is 
supposed to work, why isn't there corresponding information for the different 
classes at `Doc/library/pydoc.rst`?

Searching for something like `pydoc.TextRepr` in the search bar of 
docs.python.org doesn't return anything at all.

Sorry if there's something horrifically obvious I'm missing here guys but I'd 
appreciate any clarification on this matter.

--
assignee: docs@python
components: Documentation
messages: 383570
nosy: Faris Chugthai, docs@python
priority: normal
severity: normal
status: open
title: Viewing pydoc API documentation

___
Python tracker 

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



[issue42709] I

2020-12-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue42709] I

2020-12-21 Thread James B Wilkinson


Change by James B Wilkinson :


--
nosy: the.doc
priority: normal
severity: normal
status: open
title: I

___
Python tracker 

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



[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> But why remove it? It is in the source code.

Because traditionally, "if 0: " has been used as a way to comment out 
code while leaving syntax highlighting in place.  The expectation is all the 
code effectively ceases to exist, just like a comment.

--

___
Python tracker 

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



[issue40284] Add mapping methods to types.SimpleNamespace

2020-12-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue38381] Possible wordcode optimization for STORE/LOAD pairs

2020-12-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue1818] Add named tuple reader to CSV module

2020-12-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue40284] Add mapping methods to types.SimpleNamespace

2020-12-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> rejected

___
Python tracker 

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



[issue39159] Ideas for making ast.literal_eval() usable

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Can you explain it a bit more detailed, 
> how does this standalone expression compiler should work?

Aim for something like JSON parser but for the supported Python constant 
expressions and with the existing tokenize module to feed a hand-rolled 
on-recursive parser

--

___
Python tracker 

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



[issue42708] AttributeError when running multiprocessing on MacOS 11 with Apple Silicon (M1)

2020-12-21 Thread Reeyarn Li


Reeyarn Li  added the comment:

There is already a solution: 
https://stackoverflow.com/questions/41385708/multiprocessing-example-giving-attributeerror

When putting the function into a separate file and import it in the main file, 
there is no error at all.

##File: defs.py

def f(x):
return x*x


##File: run.py

from multiprocessing import Pool
import defs

if __name__ == '__main__':
with Pool(5) as p:
print(p.map(defs.f, [1, 2, 3]))

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



[issue42707] Python uses ANSI CP for stdio on Windows console instead of using console or OEM CP

2020-12-21 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

> I've been struggling to understand today why a simple file redirection 
> couldn't work properly today (encoding issues)

The core issue is that "working properly" is not defined in general when we're 
talking about piping/redirection, as opposed to the console. Different programs 
that consume Python's output (or produce its input) can have different 
expectations wrt. data encoding, and there is no way for Python to know it in 
advance. In your examples, you use programs like "more" and "type" to print the 
Python's output back to the console, so in this case using the OEM code page 
would produce the result that you expect. But, for example, in case Python's 
output was to be consumed by a C program that uses simple 
`fopen()/wscanf()/wprintf()` to work with text files, the ANSI code page would 
be appropriate because that's what the Microsoft C runtime library defaults to 
for wide character operations.

Python has traditionally used the ANSI code page as the default IO encoding for 
non-console cases (note that Python makes no distinction between non-console 
`sys.std*` and the builtin `open()` wrt. encoding), and this behavior can't be 
changed. You can use `PYTHONIOENCODING` or enable the UTF-8 mode[1] to change 
the default encoding.

Note that in your example you could simply use `PYTHONIOENCODING=cp850`, which 
would remove the need to use `chcp`.

[1] https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUTF8

--
nosy: +izbyshev, vstinner
versions: +Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



[issue42708] AttributeError when running multiprocessing on MacOS 11 with Apple Silicon (M1)

2020-12-21 Thread Reeyarn Li


New submission from Reeyarn Li :

I just run the sample code from multiprocessing's documentation page:

#https://docs.python.org/3/library/multiprocessing.html

from multiprocessing import Pool

def f(x):
return x*x


with Pool(5) as p:
print(p.map(f, [1, 2, 3]))

## end of code

And it cannot run, with the following error messages:
Process SpawnPoolWorker-2:
Traceback (most recent call last):
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/multiprocessing/process.py",
 line 315, in _bootstrap
self.run()
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/multiprocessing/process.py",
 line 108, in run
self._target(*self._args, **self._kwargs)
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py",
 line 114, in worker
task = get()
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/multiprocessing/queues.py",
 line 358, in get
return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'f' on 

--
components: macOS
messages: 383565
nosy: ned.deily, reeyarn, ronaldoussoren
priority: normal
severity: normal
status: open
title: AttributeError when running multiprocessing on MacOS 11 with Apple 
Silicon (M1)
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



[issue30988] Exception parsing invalid email address headers starting or ending with dot

2020-12-21 Thread Karl Fogel


Karl Fogel  added the comment:

I can also confirm this bug, with Python 3.9.1 on Debian GNU/Linux ('testing' 
distro up-to-date as of 2020-12-21).

1) Create a parser `p` with `p = 
email.parser.HeaderParser(policy=email.policy.default)`.

2) Parse a single problematic (as described below) message: `msg_headers = 
p.parsestr(msg_str)`

3) Try to get the To field: `msg_headers.get_all('to', [ ])` and get an 
exception raised: `AttributeError: 'str' object has no attribute 'token_type'` 
(with the same stack trace as OP shows).

Here is a minimal problematic message you can reproduce this with (i.e., just 
make `msg_str` have this string value):

```
>From nobody Mon Dec 21 12:00:00  2020
From: sen...@example.com
To: . 
Date: Mon, 21 Dec 2020 12:00:00 -
Message-ID: <87ab5rvds7@example.com>
Subject: This is the Subject header.

Here is the body of the message.
```

Note that *any* number of dots for the recipient's name would also result in an 
error.  The above example uses just ".", but it could be "..", "...", 
".", etc.

--
nosy: +kfogel

___
Python tracker 

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



[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2020-12-21 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +methane

___
Python tracker 

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



[issue39159] Ideas for making ast.literal_eval() usable

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset fbc7723778be01b8f3bb72d2dcac15ab9fbb9923 by Batuhan Taskaya in 
branch 'master':
bpo-39159: Declare error that might be raised from literal_eval (GH-19899)
https://github.com/python/cpython/commit/fbc7723778be01b8f3bb72d2dcac15ab9fbb9923


--

___
Python tracker 

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



[issue42008] Internal Random class calling seed() with incorrect argument

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the PR :-)

--
assignee:  -> rhettinger
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.8, Python 3.9

___
Python tracker 

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



[issue42008] Internal Random class calling seed() with incorrect argument

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset b8fde8b5418b75d2935d0ff93b20d45d5350f206 by AMIR in branch 
'master':
bpo-42008: Fix internal _random.Random() seeding for the one argument case 
(GH-22668)
https://github.com/python/cpython/commit/b8fde8b5418b75d2935d0ff93b20d45d5350f206


--

___
Python tracker 

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



[issue29030] argparse: choices override default metavar

2020-12-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
title: argparse: choices override metavar -> argparse: choices override default 
metavar

___
Python tracker 

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



[issue9625] argparse: Problem with defaults for variable nargs when using choices

2020-12-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue29030] argparse: choices override metavar

2020-12-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue42705] Intercepting thread lock objects not working under context managers

2020-12-21 Thread Mohamad Kanj


Mohamad Kanj  added the comment:

Thanks Raymond for the input.
So with some experimentation, the __enter__() & __exit__() functions could be 
traceable when other kinds of objects are used with the context manager (i.e 
with statement using file IO or custom class objects). However, just when the 
object is a Lock object, then this is not the case anymore - which basically 
shows an unusual behavior if we were to think that such statements are executed 
for a specific thread. Also please mind that the threading module already 
implements settrace() and setprofile() methods like the sys module to extend 
tracing capabilities.

--

___
Python tracker 

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



[issue16535] json encoder unable to handle decimal

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I wonder if adding something similar to what `simplejson` uses 
> (i.e. explicitly specifying in `json.dump(s)` how to
> serialize `decimal.Decimal`) could be acceptable.

+1 for this approach.  For financial applications, we need the recommended 
solution to be simple.

--
nosy: +bob.ippolito
versions: +Python 3.10 -Python 3.5

___
Python tracker 

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



[issue42151] Pure Python xml.etree.ElementTree is missing default attribute values

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Changing the behaviour of the C implementation would 
> certainly break a lot more code than changing the Python
> implementation.

+1 for changing only the Python implementation.

--
nosy: +rhettinger

___
Python tracker 

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



[issue42705] Intercepting thread lock objects not working under context managers

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The sys.setprofile() doc don't make it clear whether the __enter__ and __exit__ 
call were intended to be traceable events.  The docs do state, "there is no way 
for the profiler to know about context switches between threads, so it does not 
make sense to use this in the presence of multiple threads."

--
nosy: +rhettinger, vstinner

___
Python tracker 

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



[issue42686] include built-in Math functions in SQLite to 3.35.0 of march 2021

2020-12-21 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> So, can this be closed?

For macOS, the SQLITE_ENABLE_MATH_FUNCTIONS option is enabled by default, but 
I'm not sure about the Windows build. The SQLite docs says: 
"This option is also included on Windows builds using the "Makefile.msc" 
makefile for nmake."

--

___
Python tracker 

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



[issue42686] include built-in Math functions in SQLite to 3.35.0 of march 2021

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> but why would you do your maths computations in sql?

There are number of reasons it might be more convenient in SQL.  For example, 
it could be handy to create views measured in degrees instead of radians.  That 
might make where clauses in queries a little easier to read.


> Seems like the math functions will be included by default anyways

So, can this be closed?

--
nosy: +rhettinger

___
Python tracker 

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



[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

On Mon, Dec 21, 2020 at 09:11:48PM +, Samuel Marks wrote:

> There were only 12k occurrences, I'm sure I could manually go through that
> in an afternoon. Would you accept it then?

Assuming "an afternoon" is half a work day, so 4 hours, that's 1.2 
seconds per occurrence. So no, not even if you were a trusted core 
developer.

--

___
Python tracker 

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



[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Samuel Marks


Samuel Marks  added the comment:

There were only 12k occurrences, I'm sure I could manually go through that
in an afternoon. Would you accept it then?

On Tue, 22 Dec 2020, 12:22 am Eric V. Smith,  wrote:

>
> Eric V. Smith  added the comment:
>
> See https://github.com/ikamensh/flynt#dangers-of-conversion for reasons.
>
> Would I like to see all string literal formatting done with f-strings? Yes!
>
> Would I accept the risk and hassle of doing it blindly? No.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--
nosy: +SamuelMarks

___
Python tracker 

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



[issue42686] include built-in Math functions in SQLite to 3.35.0 of march 2021

2020-12-21 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

It is probably harmless to enable the option, especially if it will be 
the SQLite default, but why would you do your maths computations in sql, 
using the limited set of functions available, when you could do them in 
Python, with a much larger set of available functions and better 
debugging facilities?

--

___
Python tracker 

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



[issue42702] Inconsistent state after autoreconf

2020-12-21 Thread agbaroni


agbaroni  added the comment:

I'm closing the issue: I hadn't the autoconf-archive package on Fedora 33.

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



[issue42707] Python uses ANSI CP for stdio on Windows console instead of using console or OEM CP

2020-12-21 Thread Alexandre

New submission from Alexandre :

Hello, 

first of all, I hope this was not already discussed (I searched the bugs but it 
might have been discussed elsewhere) and it's really a bug.

I've been struggling to understand today why a simple file redirection couldn't 
work properly today (encoding issues) and I think I finally understand the 
whole thing.

There's an IO codepage set on Windows consoles (`chcp` for cmd, 
`[Console]::InputEncoding; [Console]::OutputEncoding` for PowerShell ; chcp 
will not work on Powershell while it displays it set the CP), 850 for my locale.
When there's no redirection / piping, PyWindowsConsoleIO take cares of the 
encoding (utf-8 is seems), but when there's redirection or piping, encoding 
falls back to ANSI CP (from config_get_locale_encoding).

This behavior seems to be incorrect / breaking things, an example:
* testcp.py (file encoded as utf-8)
```
#!/usr/bin/env python3
# -*- coding: utf-8

print('é')
```

* using cmd:
```
# Test condition
L:\Cop>chcp
Page de codes active : 850

# We're fine here
L:\Cop>py testcp.py
é
L:\Cop>py -c "import sys; print(sys.stdout.encoding)"
utf-8

# Now with piping
L:\Cop>py -c "import sys; print(sys.stdout.encoding)" | more
cp1252

L:\Cop>py testcp.py | more
Ú
L:\Cop>py testcp.py > lol && type lol
Ú

# If we adjust cmd CP, it's fine too:
L:\Cop>chcp 1252
Page de codes active : 1252
L:\Cop>py testcp.py | more
é
```

* with pwsh:
```
PS L:\Cop> ([Console]::InputEncoding, [Console]::OutputEncoding) | select 
CodePage

CodePage

 850
 850

# Fine without redirection
PS L:\Cop> py .\testcp.py
é

# Here, write-host expect cp850
PS L:\Cop> py .\testcp.py | write-output
Ú
# Same with Out-file (used by ">")
PS L:\Cop> py .\testcp.py > lol; Get-Content lol
Ú

# 
PS L:\Cop> py .\testcp.py | more
Ú
```

By reading some sources today to solve my issue, I found many solutions:
* in PS `[Console]::OutputEncoding = [Text.Utf8Encoding]::new($false); 
$env:PYTHONIOENCODING="utf8"` or `[Console]::OutputEncoding = 
[Text.Encoding]::GetEncoding(1252)`
* in CMD `chcp 65001 && set PYTHONIOENCODING=utf8` (but this seems to break 
more) or `chcp 1252`

But reading (and trusting) 
https://serverfault.com/questions/80635/how-can-i-manually-determine-the-codepage-and-locale-of-the-current-os
 
(https://docs.microsoft.com/en-us/windows/win32/intl/locale-idefault-constants),
 I understand Python should be using reading the current CP (from 
GetConsoleOutputCP, like 
https://github.com/python/cpython/blob/3.9/Python/fileutils.c:) or using the 
default OEM CP, and not assuming ANSI CP for stdio : 
> * the OEM code page for use by legacy console applications,
> * the ANSI code page for use by legacy GUI applications.

The init path I could trace : 
> https://github.com/python/cpython/blob/3.9/Python/pylifecycle.c
> init_sys_streams
>> create_stdio 
>> (https://github.com/python/cpython/blob/3.9/Python/pylifecycle.c#L1774)
>>> open.raw : 
>>> https://github.com/python/cpython/blob/3.9/Modules/_io/_iomodule.c#L374
 https://github.com/python/cpython/blob/3.9/Modules/_io/winconsoleio.c
>> fallback to ini_sys_stream encoding
> https://github.com/python/cpython/blob/3.9/Python/initconfig.c
> config_init_stdio_encoding
> config_get_locale_encoding
> GetACP()

Some test with GetConsoleCP:
```
L:\Cop>py -c "import os; print(os.device_encoding(0), os.device_encoding(1))" | 
more
cp850 None

L:\Cop>type nul | py -c "import os; print(os.device_encoding(0), 
os.device_encoding(1))"
None cp850

L:\Cop>type nul | py -c "import ctypes; 
print(ctypes.windll.kernel32.GetConsoleCP(), 
ctypes.windll.kernel32.GetConsoleOutputCP())"
850 850

L:\Cop>py -c "import ctypes; print(ctypes.windll.kernel32.GetConsoleCP(), 
ctypes.windll.kernel32.GetConsoleOutputCP())" | more
850 850
```

Some links / documentations, if useful:
* 
https://serverfault.com/questions/80635/how-can-i-manually-determine-the-codepage-and-locale-of-the-current-os
* https://docs.microsoft.com/en-us/windows/win32/intl/locale-idefault-constants
* https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getoemcp
* https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getacp
* https://docs.microsoft.com/en-us/windows/console/getconsoleoutputcp
* 
https://stackoverflow.com/questions/56944301/why-does-powershell-redirection-change-the-formatting-of-the-text-content
* 
https://stackoverflow.com/questions/19122755/output-echo-a-variable-to-a-text-file
* 
https://stackoverflow.com/questions/40098771/changing-powershells-default-output-encoding-to-utf-8
* Maybe related: https://github.com/PowerShell/PowerShell/issues/10907
* 
https://stackoverflow.com/questions/57131654/using-utf-8-encoding-chcp-65001-in-command-prompt-windows-powershell-window
 (will probably break things :) )
* 
https://stackoverflow.com/questions/49476326/displaying-unicode-in-powershell/49481797#49481797
* 
https://stackoverflow.com/questions/25642746/how-do-i-pipe-unicode-into-a-native-application-in-powershell


[issue42691] macOS 11.1 + Homebrew 2.6.2 + Python 3.9.1 = "IDLE" crash

2020-12-21 Thread Ned Deily


Ned Deily  added the comment:

> Should I do something with this now or just wait for updates?

I'd wait for a Homebrew recipe update.

--

___
Python tracker 

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



[issue42323] [AIX] test_math: test_nextafter(float('nan'), 1.0) does not return a NaN on AIX

2020-12-21 Thread Michael Felt


Michael Felt  added the comment:

While my patch in working - was successful in what it attempted to do, it did 
not fix this test issue.

Instead - I reinstalled the `bos.adt.libm-7.2.0.0` fileset, to backout of the 
so-called bugfix/APAR IV95512.

@David - can you take this up with AIX support - IV95112 (and more) do not seem 
to return NaN when one of the arguments is NaN.

--

___
Python tracker 

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



[issue42691] macOS 11.1 + Homebrew 2.6.2 + Python 3.9.1 = "IDLE" crash

2020-12-21 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

To use tkinter and hence IDLE and turtle on macOS, get the Mac Python installer 
on python.org.

--

___
Python tracker 

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



[issue42650] Can people use dest=argparse.SUPPRESS in custom Action classes?

2020-12-21 Thread Brad Warren


Brad Warren  added the comment:

Thanks for the help! I was mistaken here.

The behavior I want is to not add the option to the namespace regardless of 
whether or not the user set it. I was initially under the impression that 
dest=SUPPRESS caused this behavior, however, it seems to have the same behavior 
as default=SUPPRESS due to the code at 
https://github.com/python/cpython/blob/711381dfb09fbd434cc3b404656f7fd306161a64/Lib/argparse.py#L1838-L1841.
 By using default=SUPPRESS which is documented and a custom __call__ method on 
an Action class, I can get the behavior I want so I'm closing this issue.

Thanks again and sorry for the noise!

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



[issue42691] macOS 11.1 + Homebrew 2.6.2 + Python 3.9.1 = "IDLE" crash

2020-12-21 Thread Пётр Сиренко

Пётр Сиренко  added the comment:

Guys, thank you all for joining the conversation!

I don't understand what exactly should I do to fix this, but I have a lot to 
study through py4u and plenty of time before I will really need Python fixed.
Should I do something with this now or just wait for updates?

--

___
Python tracker 

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



[issue42691] macOS 11.1 + Homebrew 2.6.2 + Python 3.9.1 = "IDLE" crash

2020-12-21 Thread FX Coudert


FX Coudert  added the comment:

Our messages crossed, thanks Ned for the help. Hopefully we'll be solving this 
in a way that benefit most users.

--

___
Python tracker 

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



[issue42691] macOS 11.1 + Homebrew 2.6.2 + Python 3.9.1 = "IDLE" crash

2020-12-21 Thread FX Coudert


FX Coudert  added the comment:

But we can override with --with-tcltk-includes and --with-tcltk-libs
I've opened a pull request for Homebrew to switch to recent tcl-tk: 
https://github.com/Homebrew/homebrew-core/pull/67378

--

___
Python tracker 

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



[issue42691] macOS 11.1 + Homebrew 2.6.2 + Python 3.9.1 = "IDLE" crash

2020-12-21 Thread Ned Deily


Ned Deily  added the comment:

If you are not using Tcl and Tk framework builds installed in /Library, you use 
the configure or make options:

  --with-tcltk-includes='-I...'
  override search for Tcl and Tk include files
  --with-tcltk-libs='-L...'
  override search for Tcl and Tk libs

to specify exactly where to find your versions of Tcl and Tk. See the comments 
in setup.py:

def detect_tkinter_explicitly(self):
# Build _tkinter using explicit locations for Tcl/Tk.
#
# This is enabled when both arguments are given to ./configure:
#
# --with-tcltk-includes="-I/path/to/tclincludes \
#-I/path/to/tkincludes"
# --with-tcltk-libs="-L/path/to/tcllibs -ltclm.n \
#-L/path/to/tklibs -ltkm.n"
#
# These values can also be specified or overridden via make:
#make TCLTK_INCLUDES="..." TCLTK_LIBS="..."
#
# This can be useful for building and testing tkinter with multiple
# versions of Tcl/Tk.  Note that a build of Tk depends on a particular
# build of Tcl so you need to specify both arguments and use care when
# overriding.

# The _TCLTK variables are created in the Makefile sharedmods target.

--

___
Python tracker 

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



[issue42691] macOS 11.1 + Homebrew 2.6.2 + Python 3.9.1 = "IDLE" crash

2020-12-21 Thread FX Coudert


FX Coudert  added the comment:

After checking, I can see the code in cpython's setup.py is still there. 
detect_tkinter_darwin will prefer the system's version over anything we can 
specific in our cflags or ldflags. This seems contrary to the advice above not 
to use macOS system Tcl/Tk.

--

___
Python tracker 

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



[issue42706] random.uniform 2x slower than inline implementation

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> does the call/return really add that much overhead?

Yes, it does.

$ python3.9 -m timeit -s 'x=3.5' 'x**2'
500 loops, best of 5: 63.5 nsec per loop
$ python3.9 -m timeit -s 'x=3.5' -s 'f=lambda x: x**2' 'f(x)'
200 loops, best of 5: 136 nsec per loop

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



[issue42691] macOS 11.1 + Homebrew 2.6.2 + Python 3.9.1 = "IDLE" crash

2020-12-21 Thread FX Coudert


FX Coudert  added the comment:

Hi Ned,

FX from Homebrew here. One of the reasons we a couple of years ago to stick 
with macOS system tcl-tk was that cpython's configure does not currently allow 
to build against our tcl-tk, which is not a framework but a simple Unix-style 
library build. We can definitely reconsider if you recommend a newer tcl-tk, 
but do you know if the build issues with non-framework tcl-tk have been fixed?

--

___
Python tracker 

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



[issue42697] 3.8.7rc1 regression: 'free(): invalid pointer' after running backports-zoneinfo test suite

2020-12-21 Thread Paul Ganssle

Paul Ganssle  added the comment:

For future reference, this bug is triggered only when `.fromutc` is called on a 
subclass of `datetime` and the resulting date is the second ambiguous time 
(e.g. if there's a DST transition from 02:00 → 01:00, and the result of the 
`.fromutc` call is the *second* 01:30, you will trigger this issue).

Here's an MWE:

```
from backports.zoneinfo import ZoneInfo
from datetime import datetime, timezone

class SubDT(datetime):
pass

LON = ZoneInfo("Europe/London")
d = SubDT(2020, 10, 25, 1, 30, tzinfo=timezone.utc)

# Each pass through the loop inappropriately reduces the reference count on the
# `1` object by 1. Since there are usually a large number of live references to
# `1`, this won't have any immediate noticeable effect unless you do it a lot.
for i in range(1):
d.astimezone(LON)
```

--

___
Python tracker 

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



[issue42691] macOS 11.1 + Homebrew 2.6.2 + Python 3.9.1 = "IDLE" crash

2020-12-21 Thread Ned Deily


Ned Deily  added the comment:

> I have tried to update tcl-tk with the homebrew, but in command line I see 8.5
> Could you please help me to fix this tcl-tk problem?

You should check with the Homebrew project; we have no insight into or control 
over their packaging choices.  Good luck!

--

___
Python tracker 

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



[issue42701] Discrepency between configure.ac and configure

2020-12-21 Thread Ned Deily


Change by Ned Deily :


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



[issue42704] [macOS] [python3.7] : platform.machine() returns x86_64 on ARM machine

2020-12-21 Thread Ned Deily


Change by Ned Deily :


--
status: open -> closed

___
Python tracker 

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



[issue42704] [macOS] [python3.7] : platform.machine() returns x86_64 on ARM machine

2020-12-21 Thread Ned Deily


Ned Deily  added the comment:

Note also that Python 3.7 is now in the security-fix-only phase of its 
lifecycle meaning it no longer receives non-security bug fixes and binary 
installers for it will no longer be produced.  In particular, Pygthon 3.7 has 
not been updated for macOS 11 and Apple Silicon Macs and, as Ronald notes, it 
will run on Apple Silicon Macs using Rosetta 2 translation, there are some 
things that do not work correctly on Big Sur, like find_library functions.  If 
at all possible, you should upgrade to Python 3.9.1 which is supported on macOS 
11 Big Sur.

--

___
Python tracker 

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



[issue42323] [AIX] test_math: test_nextafter(float('nan'), 1.0) does not return a NaN on AIX

2020-12-21 Thread Michael Felt


Michael Felt  added the comment:

I have been doing a lot of research on this. Wish I had thought do start the 
way I finished.

Basically, when math.nextafter() was added all the AIX bots were on systems 
running AIX earlier than AIX 7.2 TL2.

When AIX 7.2 TL2 was released (roughly Q3 2017) a (major?) change was made to 
the nextafter() function.

root@gcc119:[/home2/root]instfix -k IV95512 -a
IV95512 Abstract: nextafter(+0.0, -0.0) returns +0.0 instead of -0.0.

IV95512 Symptom Text:
 If(x==y) nextafter returns x instead of y.

At first glance - it appears the CPython code is reversing the arguments:

The lines in test_math.py are currently:
 +2026  # NaN
 +2027  self.assertIsNaN(math.nextafter(NAN, 1.0))
 +2028  self.assertIsNaN(math.nextafter(1.0, NAN))
 +2029  self.assertIsNaN(math.nextafter(NAN, NAN))

Moving line 2027 (which is what is failing) to 2029 - the other two lines pass 
on an AIX system with IV95512 applied. 

As IEEE754 says (and seems to have always said):

https://pubs.opengroup.org/onlinepubs/9699919799: 

If x or y is NaN, a NaN shall be returned.

The current test in Modules/mathmodule.c might be too simple.

I am working on a PR where I check for presence of APAR IV95512 - with the 
nextafter() changes.

--

___
Python tracker 

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



[issue42706] random.uniform 2x slower than inline implementation

2020-12-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, calling functions in Python has some overhead. It is not specific to 
random.uniform().

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue42704] [macOS] [python3.7] : platform.machine() returns x86_64 on ARM machine

2020-12-21 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

That installer contains intel (x86_64) binaries. The behaviour of 
platform.machine() and platform.processor() is expected, due to Rosetta the 
binary runs as if it is running on an Intel Mac.

There is a "universal2" installer for Python 3.9.1 which will run natively on 
Arm systems.  The experience with 3th-party packages ("pip install ...") might 
be a bit rough though: this installer variant is quite new and I expect that 
most packages with C extensions do not yet have binary wheels for this variant.

--
resolution:  -> not a bug
stage:  -> resolved

___
Python tracker 

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



[issue42706] random.uniform 2x slower than inline implementation

2020-12-21 Thread Scott Norton


New submission from Scott Norton :

The library function random.uniform takes about twice as long as a manual 
inline implementation (Python 3.9.1).

>>> import timeit
>>> timeit.timeit('3 + (8 - 3) * random.random()', 'import random')
0.154088729228
>>> timeit.timeit('a + (b - a) * random.random()', 'import random\na = 3\nb = 
>>> 8')
0.17950458899986188
>>> timeit.timeit('random.uniform(3, 8)', 'import random')  # does the 
>>> call/return really add that much overhead?
0.3114541869894

--
components: C API
messages: 383532
nosy: Scott Norton
priority: normal
severity: normal
status: open
title: random.uniform 2x slower than inline implementation
type: performance
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



[issue42704] [macOS] [python3.7] : platform.machine() returns x86_64 on ARM machine

2020-12-21 Thread Malay Shah


Malay Shah  added the comment:

I downloaded it from : 
www.python.org/ftp/python/3.7.9/python-3.7.9-macosx10.9.pkg

--

___
Python tracker 

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



[issue42705] Intercepting thread lock objects not working under context managers

2020-12-21 Thread Mohamad Kanj


New submission from Mohamad Kanj :

The interception of Python and C functions is achieved through the `sys` module 
- however, when using thread locks from `threading` module for instance under 
context managers, the calls on the lock to `acquire()` and `release()` cannot 
be witnessed. If these methods were to be called explicitly then this is no 
problem.

--

___
Python tracker 

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



[issue42705] Intercepting thread lock objects not working under context managers

2020-12-21 Thread Mohamad Kanj


Change by Mohamad Kanj :


--
assignee: docs@python
components: C API, Demos and Tools, Distutils, Documentation
files: tracing-locking-mechanisms.py
nosy: docs@python, dstufft, eric.araujo, mhmdkanj
priority: normal
severity: normal
status: open
title: Intercepting thread lock objects not working under context managers
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49695/tracing-locking-mechanisms.py

___
Python tracker 

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



[issue36968] Top level transient modal windows stopping deiconify on windows 10

2020-12-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Tkinter is a wrapper around the Tk library. This seems a bug in Tk itself. 
Please file report on the corresponding bug tracker.

--
nosy: +serhiy.storchaka
resolution:  -> third party
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



[issue42704] [macOS] [python3.7] : platform.machine() returns x86_64 on ARM machine

2020-12-21 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

How did you install python3.7?

Platform.machine() will return "x86_64" when running in Rosetta 3. That is, 
when python itself is an x86_64 binary.

--

___
Python tracker 

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



[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Ned Batchelder


Ned Batchelder  added the comment:

This feels like a recurring debate.  I will need some time to lay out my case.  
Perhaps it needs a wider audience than a bpo issue?

--

___
Python tracker 

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



[issue42703] Asyncio Event Documentation Links Incorrect

2020-12-21 Thread Matt Fowler


Change by Matt Fowler :


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

___
Python tracker 

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



[issue42701] Discrepency between configure.ac and configure

2020-12-21 Thread Michael Felt


Michael Felt  added the comment:

The 'issue' is that a package known as autoconf-archive must ALSO be installed 
- so that aclocal has a definition for ax_check_compile_flag.

Guessing that resolution is `third_party` - If not, please explain what the 
resolution flag is used for.

--
resolution:  -> third party

___
Python tracker 

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



[issue42704] [macOS] [python3.7] : platform.machine() returns x86_64 on ARM machine

2020-12-21 Thread Malay Shah


New submission from Malay Shah :

there is a discrepancy in platform.machine() behaviour on mac ARM:

In python2.7.16 ,  platform.machine() returns : "arm64"
In python3.7.9 , platform.machine() returns : "x86_64"

--
components: macOS
messages: 383525
nosy: ned.deily, ronaldoussoren, shah.malay04
priority: normal
severity: normal
status: open
title: [macOS] [python3.7] : platform.machine() returns x86_64 on ARM machine
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue42703] Asyncio Event Documentation Links Incorrect

2020-12-21 Thread Matt Fowler


New submission from Matt Fowler :

The documentation for `asyncio.Event` has incorrect links. The `wait` coroutine 
incorrectly links to the docs for the `asyncio.wait` waiting primitive, and the 
`set` method incorrectly links to the docs for the `set` class constructor.

--
assignee: docs@python
components: Documentation
messages: 383524
nosy: docs@python, mattfowler
priority: normal
severity: normal
status: open
title: Asyncio Event Documentation Links Incorrect
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



[issue42257] platform.libc_ver() doesn't consider in case of executable is empty string

2020-12-21 Thread Kurochan


Kurochan  added the comment:

Can anyone review this PR?

--

___
Python tracker 

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



[issue42701] Discrepency between configure.ac and configure

2020-12-21 Thread Michael Felt


Michael Felt  added the comment:

This is beginning to look like it is an issue with the version of automake 
installed: 

aixtools@gcc119:[/home/aixtools/cpython/cpython-master]automake --version
Unescaped left brace in regex is deprecated, passed through in regex; marked by 
<-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake line 3936.
automake (GNU automake) 1.15
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later 

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey 
   and Alexandre Duret-Lutz .


Will test on a system where I can install the latest automake.

Assuming an updated version of automake fixes that - but not knowing autotools 
well enough - is there a simple addition to ensure that automake-1.16 is used?

--

___
Python tracker 

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



[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Mark Shannon


Mark Shannon  added the comment:

You should never have to disable optimizations.

Let's be clear about what an optimization is.

An optimization (CS not math) is a change to the program such that it has the 
same effect, according to the language spec, but improves some aspect of the 
behavior, such as run time or memory use.

Any transformation that changes the effect of the program is not an 
optimization.

You shouldn't be able to tell, without timing the program (or measuring memory 
use, observing race conditions, etc.) whether optimizations are turned on or 
not.

Removing bytecodes for dead code is a legal optimization. It can never run, so 
we can't tell by observation whether it is there or not.

PEP 626 makes the lines number traced part of the language specification.
So the optimizer *must* respect line numbers.

Thus, removing all trace of `if 0:` is not legal since we could observe that 
change.
Hypothetically, we could change the line number table to allow multiple lines 
per bytecode and remove the NOP. The important point is that is coverage.py 
shouldn't care, or even know, if we do so.

--

___
Python tracker 

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



[issue42634] Incorrect line number in bytecode for try-except-finally

2020-12-21 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset f2dbfd7e20431f0bcf2b655aa876afec7fe03c6f by Mark Shannon in 
branch 'master':
bpo-42634: Mark reraise after except blocks as artificial. (GH-23877)
https://github.com/python/cpython/commit/f2dbfd7e20431f0bcf2b655aa876afec7fe03c6f


--

___
Python tracker 

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



[issue42701] Discrepency between configure.ac and configure

2020-12-21 Thread Michael Felt


Michael Felt  added the comment:

This is what I find via bisect:

aixtools@gcc119:[/home/aixtools/cpython/cpython-master]git checkout . && git 
bisect bad
c6d7e82d19c091af698d4e4b3623648e259843e3 is the first bad commit
commit c6d7e82d19c091af698d4e4b3623648e259843e3
Author: Petr Viktorin 
Date:   Thu Oct 22 18:11:53 2020 +0200

bpo-38980: Only apply -fno-semantic-interposition if available (GH-22892)

:100644 100644 b5f9cb0e8da44fb378e7e082f23025901cb06c6c 
99913e7f3b85cf9ebba261073883c50b3f9a9ecd M  aclocal.m4
:100755 100755 df7118f68d3bb484148f8b719b1550676c029493 
29f33b543ecc02c8eaae7cfd66c442a4bd60d44a M  configure
:100644 100644 c63c1e88a2302f7a60e9c2319f9965c1d7830d47 
9698c3c888a6b7f74f2458df94bf21e51b6793d7 M  configure.ac

--

___
Python tracker 

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



[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Eric V. Smith


Eric V. Smith  added the comment:

See https://github.com/ikamensh/flynt#dangers-of-conversion for reasons.

Would I like to see all string literal formatting done with f-strings? Yes!

Would I accept the risk and hassle of doing it blindly? No.

--

___
Python tracker 

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



[issue42702] Inconsistent state after autoreconf

2020-12-21 Thread agbaroni


New submission from agbaroni :

git clone https://github.com/python/cpython && cd cpython && autoreconf && 
./configure --with-pydebug gives the following error:

checking for --enable-optimizations... no
./configure: line 6443: syntax error near unexpected token 
`-fno-semantic-interposition,'
./configure: line 6443: `  
AX_CHECK_COMPILE_FLAG(-fno-semantic-interposition,'

Here (section 1.5): https://cpython-devguide.readthedocs.io/setup/ speaks about 
only autoreconf.

--
messages: 383517
nosy: agbaroni
priority: normal
severity: normal
status: open
title: Inconsistent state after autoreconf
type: behavior
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



[issue35790] Correct the description of sys.exc_info() and add a code example

2020-12-21 Thread Julien Palard


Change by Julien Palard :


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



[issue35790] Correct the description of sys.exc_info() and add a code example

2020-12-21 Thread Julien Palard

Julien Palard  added the comment:


New changeset d515c610c61b9a8c40c037a3dc3bfc8d67563658 by Géry Ogam in branch 
'master':
bpo-35790: Correct the description of sys.exc_info() and add a code example 
(GH-11625)
https://github.com/python/cpython/commit/d515c610c61b9a8c40c037a3dc3bfc8d67563658


--

___
Python tracker 

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



[issue42701] Discrepency between configure.ac and configure

2020-12-21 Thread Michael Felt


New submission from Michael Felt :

While working on a PR for issue42323 I get an error with the generated 
./configure even without my patch.

Working from commit 37a6d5f8027f969418fe53d0a73a21003a8e370d

aixtools@gcc119:[/home/aixtools/cpython/cpython-master]git log --oneline | head
37a6d5f (HEAD -> master, upstream/master, upstream/HEAD, bpo-42323) [WIP/RFC] 
bpo-15872: tests: remove oddity from test_rmtree_errors (GH-22967)
ab74c01 bpo-31904: Fix site and sysconfig modules for VxWorks RTOS (GH-21821)
c95f8bc bpo-42669: Document that `except` rejects nested tuples (GH-23822)
b0398a4 bpo-42572:  Improve argparse docs for the type parameter. (GH-23849)
a44ce6c bpo-42604: always set EXT_SUFFIX=${SOABI}${SHLIB_SUFFIX} when using 
configure (GH-23708)

aixtools@gcc119:[/home/aixtools/cpython/cpython-master]rpm -qa autoconf
autoconf-2.69-2.noarch

aixtools@gcc119:[/home/aixtools/cpython/cpython-master]autoreconf -v
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /opt/freeware/bin/autoconf
autoreconf: running: /opt/freeware/bin/autoheader
autoreconf: configure.ac: not using Automake
autoreconf: Leaving directory `.'

Your branch is up-to-date with 'upstream/master'.
Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)

modified:   aclocal.m4
modified:   configure
modified:   pyconfig.h.in

aixtools@gcc119:[/home/aixtools/cpython/cpython-master]git diff configure
diff --git a/configure b/configure
index f07edff..6f0d51f 100755
--- a/configure
+++ b/configure
@@ -6471,44 +6471,10 @@ if test "$Py_OPT" = 'true' ; then
   DEF_MAKE_RULE="build_all"
   case $CC in
 *gcc*)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler 
accepts -fno-semantic-interposition" >&5
-$as_echo_n "checking whether C compiler accepts -fno-semantic-interposition... 
" >&6; }
-if ${ax_cv_check_cflags___fno_semantic_interposition+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-  ax_check_save_flags=$CFLAGS
-  CFLAGS="$CFLAGS  -fno-semantic-interposition"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ax_cv_check_cflags___fno_semantic_interposition=yes
-else
-  ax_cv_check_cflags___fno_semantic_interposition=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CFLAGS=$ax_check_save_flags
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$ax_cv_check_cflags___fno_semantic_interposition" >&5
-$as_echo "$ax_cv_check_cflags___fno_semantic_interposition" >&6; }
-if test "x$ax_cv_check_cflags___fno_semantic_interposition" = xyes; then :
-
+  AX_CHECK_COMPILE_FLAG(-fno-semantic-interposition,
   CFLAGS_NODIST="$CFLAGS_NODIST -fno-semantic-interposition"

aixtools@gcc119:[/home/aixtools/cpython/cpython-master]./configure
checking for git... found
checking build system type... powerpc-ibm-aix7.2.4.0
checking host system type... powerpc-ibm-aix7.2.4.0
checking for python3.10... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "aix"
checking for gcc... gcc
checking whether the C compiler works... yes
...
checking for --with-pydebug... no
checking for --with-trace-refs... no
checking for --with-assertions... no
checking for --enable-optimizations... no
./configure[6464]: syntax error at line 6475 : `(' unexpected
aixtools@gcc119:[/home/aixtools/cpython/cpython-master]

Unclear - to me - what is wrong with configure.ac or autoconf that is installed.

aixtools@gcc119:[/home/aixtools/cpython/cpython-master]autoconf --version
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
, 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.

--
components: Build
messages: 383515
nosy: Michael.Felt
priority: normal
severity: normal
status: open
title: Discrepency between configure.ac and configure
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



[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Samuel Marks


Samuel Marks  added the comment:

EDIT: Just found https://github.com/ikamensh/flynt

--

___
Python tracker 

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



[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Samuel Marks

Samuel Marks  added the comment:

I suppose that's a good justification to never improve/upgrade the syntax and 
quality of the codebase.

In terms of automatic upgrades of the codebase, one could always replicate the 
approach I use in doctrans—i.e., use of `ast` and/or `inspect`—to automatically 
upgrade syntax from `%` and `.format` to use f-strings.

Would that be acceptable?

--

___
Python tracker 

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



[issue42696] Duplicated unused bytecodes at end of function

2020-12-21 Thread Mark Shannon


Mark Shannon  added the comment:

Our reachability analysis is correct (in this case at least).
There is no unreachable code here.

In theory we could merge the two basic blocks at the end, but searching for 
identical blocks and merging them is potentially quite expensive (and fiddly).

What might be better is to be change the order of optimizations, so that we 
duplicate BBs after we have performed jump-to-jump elimination.

Is this a problem in practice?

--

___
Python tracker 

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



[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Ned Batchelder


Ned Batchelder  added the comment:

> PEP 626 states that *all* executed code gets traced.

Yes, but reading the PEP now, it's not clear what "executed" means. Do we mean 
"conceptually executed", or, "executed as compiled by the optimizing compiler"?

> In fact this NOP can be removed by rewriting the bytecode to:

That change looks both difficult and confusing.  If we want to keep an "if 0:" 
line in the bytecode, NOP is the best way to do it.

> But why remove it? It is in the source code.

I think the reason you are keeping it now isn't because it is in the source 
code.  Lines after returns are in the source code, but are now removed because 
they aren't in the path of execution.  "if 0:" is in the path of execution, so 
now you are keeping it. (I guess: I don't mean to put words in your mouth.)

As I mentioned, this is a change from previous versions, which removed the "if 
0:" as uninteresting code.

> Do we want tracing and profiling to depend on what transformations the 
> optimizer does or does not make?

Tracing has long depended on the optimizer's transformations.  When the 
optimizer removes a jump to a jump, the tracing never sees the removed 
intermediate jump.

The reason I am writing these bug reports is because coverage.py tries to track 
CPython's optimizations.  Coverage.py "knows" that "if 0:" lines won't appear 
in the trace, because previous versions removed them.

Unfortunately, it's not possible to make the match perfect. See bug 2506 for 
the original debate about this point.  As it stands now, CPython will keep 
statements in the byte code that are "conceptually" executed, but because of 
optimization, are never executed.  This creates a gap between the developer's 
mental model and the data produced by tools.

I can adjust coverage.py to reflect the decision either way from this bug 
report. Mostly I raise the issues to point out differences and to get a clear 
decision about whether it's desired behavior.

> If the runtime does speculatively inlining, should it change what code is to 
> be traced?

I hope this is purely hypothetical. If CPython gets to that point we are going 
to have to revisit what kinds of controls there are to disable optimizations.

--

___
Python tracker 

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



[issue42634] Incorrect line number in bytecode for try-except-finally

2020-12-21 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +22740
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/23877

___
Python tracker 

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



[issue42696] Duplicated unused bytecodes at end of function

2020-12-21 Thread Mark Shannon


Mark Shannon  added the comment:

My guess is that we are changing the CFG after computing reachability leaving 
unreachable blocks marked as reachable.

--
assignee:  -> Mark.Shannon

___
Python tracker 

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



[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Mark Shannon


Mark Shannon  added the comment:

But why remove it? It is in the source code.

Do we want tracing and profiling to depend on what transformations the 
optimizer does or does not make?

What lines are to be traced here? What is the last line executed?

def no_code():
if 0:
some_code


Consider the code:

def one():
return 1

def two():
return one() + 1

def const_test():
if two() != 2:
   lots_of_code_here

What lines should be traced here?
If the runtime does speculatively inlining, should it change what code is to be 
traced?

--

___
Python tracker 

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



[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Eric V. Smith


Eric V. Smith  added the comment:

> Wait I don't understand why you wouldn't accept a wholesale replacement of 
> all `%` and `format` with f-strings through the entire CPython codebase 
> [master branch]?

For such a large change it's difficult to review every single change and ensure 
it's correct. I'm guessing there are thousands of occurrences.

In addition, it runs the risk of breaking any existing pull requests.

And in the vast majority of cases it wouldn't make any noticeable performance 
difference. So why risk the breakage and endure the hassle?

--

___
Python tracker 

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



[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Ned Batchelder


Ned Batchelder  added the comment:

Previous versions of Python completely removed the "if 0:" statement, because 
it would have no effect.  The condition was checked at compile time, 
effectively.  It seems odd for 3.10 to add it back in.

--

___
Python tracker 

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



[issue42686] include built-in Math functions in SQLite to 3.35.0 of march 2021

2020-12-21 Thread Erlend Egeberg Aasland

Erlend Egeberg Aasland  added the comment:

Seems like the math functions will be included by default anyways, so we'll 
have to explicitly exclude them if we don't want them.

https://www.sqlite.org/draft/compile.html#enable_math_functions:
"This option [SQLITE_ENABLE_MATH_FUNCTIONS] is automatically added to the 
Makefile by the configure script on unix platforms, unless the --disable-math 
option is used."

--

___
Python tracker 

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



[issue42634] Incorrect line number in bytecode for try-except-finally

2020-12-21 Thread Mark Shannon


Change by Mark Shannon :


--
resolution: fixed -> 

___
Python tracker 

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



[issue42693] "if 0:" lines are traced; they didn't use to be

2020-12-21 Thread Mark Shannon


Mark Shannon  added the comment:

Yes, this is change is deliberate.

PEP 626 states that *all* executed code gets traced.
Occasionally that will result in NOPs in the code, that are necessary 
for correctness, but cannot be removed by the optimizer.
Is this a problem in practice?

In fact this NOP can be removed by rewriting the bytecode to:

  2   0 LOAD_CONST   0 (10)
  2 STORE_NAME   0 (x)

  3   4 LOAD_CONST   3 (20)

  5   6 STORE_NAME   2 (y)
  8 LOAD_CONST   4 (None)
 10 RETURN_VALUE

but that is a relatively rare case where the proceeding or following 
instruction has no observable side-effects.
It is also non-trivial to implement, as the NOP and LOAD_CONST are in different 
basic blocks.

--

___
Python tracker 

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



[issue31483] ButtonPress event not firing until button release Python 3.6.1

2020-12-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And in any case Tkinter is just a wrapper around Tk. If there is a bug it 
should be reported on the Tk bug tracker.

--
resolution:  -> third party
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



[issue42686] include built-in Math functions in SQLite to 3.35.0 of march 2021

2020-12-21 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

I see no reason not to build SQLite with -DSQLITE_ENABLE_MATH_FUNCTIONS for the 
Windows and macOS builds. Why take the detour through the Python library when 
you can use the built-in SQLite functions?

The change is trivial: Add -DSQLITE_ENABLE_MATH_FUNCTIONS to 
PCbuild/sqlite3.vcxproj and Mac/BuildScript/build-installer.py.

--
nosy: +erlendaasland

___
Python tracker 

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



[issue34550] UnicodeDecodeError when invoke method configure() of Menu instance

2020-12-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There should no be any UnicodeDecodeError now. Tkinter on Windows uses now the 
UTF-16 encoding with the surrogatepass error handler which should never fail.

Could you please confirm that the issue is gone?

--
status: open -> pending

___
Python tracker 

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



[issue37232] Parallel compilation fails because of low ulimit.

2020-12-21 Thread Jakub Kulik


Jakub Kulik  added the comment:

I am closing this as it is true that the limit on files of 256 is pretty low, 
and no matter how robust you make it, arbitrarily low ulimits will crash it 
anyway.

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



[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Samuel Marks


Samuel Marks  added the comment:

Wait I don't understand why you wouldn't accept a wholesale replacement of all 
`%` and `format` with f-strings through the entire CPython codebase [master 
branch]?

BTW: Kinda unrelated, but would be great to have perspective on this little 
project - https://github.com/SamuelMarks/doctrans - I'm interested in wholesale 
enforcement of code consistency and translating between constructs (e.g., 
dataclass to/fro argparse to/fro class method; ReST to/fro Google to/fro NumPy 
dostrings; inline types to/fro types in docstrings; with more planned)

--

___
Python tracker 

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



[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Eric V. Smith


Eric V. Smith  added the comment:

@samuelmarks:

A place where there it is possible to improve performance is with f-strings 
replacing %-formatting or str.format. This does move significant work to 
compile time.

However, we'd be unlikely to accept a wholesale stdlib change that swaps in 
f-strings. Instead, if there were specific places where benchmarks showed real 
world improvements, we should look at those on a case-by-case basis.

Also note that replacing %-formatting with .format() is almost always a 
performance pessimization.

--

___
Python tracker 

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



[issue35728] Tkinter font nametofont requires default root

2020-12-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +easy
versions: +Python 3.10 -Python 3.8

___
Python tracker 

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



[issue4343] tkinter: add _get_master() and use it consistently

2020-12-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not think that popping up a root window on first call of Variable() or 
getboolean() is a good idea. Issue42630 fixed errors in other way. A root 
window is not automatically created for non-graphic objects (like Variable), 
instead a RuntimeError with relevant error message is raised.

--
status: open -> pending

___
Python tracker 

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



[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Samuel Marks

Samuel Marks  added the comment:

Yeah I hear ya, was just trying for the most concise issue title. I tend to 
[over]use `map`, `filter`, `filterfalse` and other `itertools` and `operator` 
methods in my own codebase.

Surprised with that result, that using an explicit list is actually faster. 
Seems like an obvious* micro-optimisation. *But don't want to say that unless 
I'm actually maintaining/contributing-to your C code.

It's also surprising—last time I checked—that lists are faster to construct 
than tuples. When I create codebases or maintain other peoples, I try and:
- remove all unnecessary mutability (incl. replacing lists with tuples);
- flatten `.append` occurrences into generator comprehensions or map;
- remove all indentation creating for-loops, replacing with comprehensions or 
map and functions or lambdas
- combine generators rather than concatenate lists;

The general idea here is to evaluate at the time of computation, and be lazy 
everywhere else. So searching the whole codebase for lists and other mutable 
structures is a good first step.

But maybe with efficiency losses, like shown here, means that this would only 
aid [maybe] in readability, understandability, traceability & whatever other 
functional -ility; but not performance?

:(

--

___
Python tracker 

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



[issue42697] 3.8.7rc1 regression: 'free(): invalid pointer' after running backports-zoneinfo test suite

2020-12-21 Thread Michał Górny

Michał Górny  added the comment:

Thank you for debugging this.  I can confirm that this patch resolves my issue.

--

___
Python tracker 

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



[issue18131] Tkinter Variables require a proper master

2020-12-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And the first issue was fixed in issue42630.

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



[issue42277] Solaris & PEP 3149: start using ABI version tagged .so files

2020-12-21 Thread Jakub Kulik


Change by Jakub Kulik :


--
resolution:  -> duplicate
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



[issue42277] Solaris & PEP 3149: start using ABI version tagged .so files

2020-12-21 Thread Jakub Kulik


Jakub Kulik  added the comment:

This was resolved with issue 42604 and PR 23708.

--

___
Python tracker 

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



  1   2   >