[issue43382] github CI blocked by the Ubuntu CI with an SSL error

2021-03-02 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks for the quick workaround!

The problem could be caused by a downstream patch in Ubuntu's OpenSSL version. 
Vanilla OpenSSL doesn't fail like that.

--

___
Python tracker 

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



[issue43384] Include regen-stdlib-module-names in regen-all

2021-03-02 Thread Neil Schemenauer


Change by Neil Schemenauer :


--
keywords: +patch
pull_requests: +23494
pull_request: https://github.com/python/cpython/pull/24713

___
Python tracker 

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



[issue43384] Include regen-stdlib-module-names in regen-all

2021-03-02 Thread Neil Schemenauer


New submission from Neil Schemenauer :

While I was fixing the regen-frozen issue, I noticed it seems unnecessary to 
have regen-stdlib-module-names separate from regen-all.  Maybe Victor knows why 
it needs to be separate.  If it doesn't need to be separate, the CI scripts can 
be slightly simplified.

--
components: Build
messages: 388003
nosy: nascheme
priority: normal
severity: normal
stage: patch review
status: open
title: Include regen-stdlib-module-names in regen-all
type: enhancement

___
Python tracker 

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



[issue43382] github CI blocked by the Ubuntu CI with an SSL error

2021-03-02 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

I think it may be related to bpo-41561.  There is a bug in the Ubuntu tracker 
as well:

https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1899878

I agree with the temporary fix to use "ubuntu-18.04" for CI testing.

--
nosy: +nascheme

___
Python tracker 

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



[issue43382] github CI blocked by the Ubuntu CI with an SSL error

2021-03-02 Thread Brandt Bucher


Change by Brandt Bucher :


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

___
Python tracker 

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



[issue43382] github CI blocked by the Ubuntu CI with an SSL error

2021-03-02 Thread Brandt Bucher


Brandt Bucher  added the comment:

I forgot to mention that I confirmed that the last passing test run used 18.04 
(click "set up job" -> "Operating System" to see):

https://github.com/python/cpython/runs/2013210763?check_suite_focus=true

The next one, which started the current chain of failures, used 20.04:

https://github.com/python/cpython/runs/2018900756?check_suite_focus=true

I'm still not sure *why* this broke CI, though. Perhaps our cached OpenSSL is 
no longer valid?

--

___
Python tracker 

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



[issue40059] Provide a toml module in the standard library

2021-03-02 Thread Eli Schwartz


Change by Eli Schwartz :


--
nosy: +eschwartz

___
Python tracker 

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



[issue43382] github CI blocked by the Ubuntu CI with an SSL error

2021-03-02 Thread Brandt Bucher


Brandt Bucher  added the comment:

It seems that GitHub recently changed their "ubuntu-latest" image from Ubuntu 
18.04 to Ubuntu 20.04.

A good temporary workaround would probably be to change this line:

https://github.com/python/cpython/blob/727a68b6e592eada5a65935de5c8428ef50e8741/.github/workflows/build.yml#L130

...to read "ubuntu-18.04".

--
nosy: +brandtbucher

___
Python tracker 

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



Re: editor recommendations?

2021-03-02 Thread Dan Stromberg
On Tue, Mar 2, 2021 at 8:11 PM Dan Stromberg  wrote:

>
> On Tue, Mar 2, 2021 at 8:00 PM Russell  wrote:
>
>> Ethan Furman  wrote:
>> > I'm currently using vim, and the primary reason I've stuck with it for
>> so long is because I can get truly black screens with it.  By which I mean
>> that I have a colorful window title bar, a light-grey menu bar, and then a
>> light-grey frame around the text-editing window (aka the only window), and
>> a nice, black-background editing area.
>>
>> I use vim. It's actually extremely powerful, especially for text/code
>> editing. I'd recommend reading one of the many books on using vim
>> effectively. Also, plugins can really add a lot...
>>
>
> On the subject of learning vim: There's an excellent vi cheat sheet
> available on the internet.  I've put a copy of it at
> https://stromberg.dnsalias.org/~strombrg/vi.ref.6
>
> vi is of course the predecessor of vim. But that cheat sheet is still
> great for learning much of vim.
>

I just ran across:  http://lib.ru/MAN/viref.txt
...which is pretty much the same thing, but converted to nice HTML.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43383] imprecise handling of weakref callbacks

2021-03-02 Thread Konrad Schwarz


New submission from Konrad Schwarz :

I am seeing the following non-deterministic behavior:

My code processes DeviceTree, a tree-based specification format for hardware 
descriptions, that includes cross-references ("phandles").  For all intents and 
purposes, this format is similar to XML; phandles are analog to ID/IDREFS.

To prevent reference cycles and avoid the need for garbage collection, my code 
uses weakref.proxy for parent pointers and weakref.ref for cross-references.

My goal is to provide a "projection" operation on a DeviceTree: creating 
derived DeviceTrees that model subsets of the hardware (this is to partition 
the hardware into multiple independent sub-machines).  The projection is 
specified by newly introduced nodes and attributes (aka properties) in the 
tree; phandles are used to indicate which part belongs to which partition.

Python weak references provide a callback interface to indicate the demise of 
their referents and my code uses that to prune the tree: e.g., if a node 
modeling a partition is deleted, nodes that reference that node (i.e., indicate 
they belong to that partition) are deleted in the corresponding weakref 
callback.  So technically, the code implicitly uses the interpreters list of 
weak referrers (__weakref__) to find and execute code on them when the 
referent's state changes.

This works exactly as envisioned when single-stepping in PDB.

When running at full speed however, I see that weak reference callbacks are 
being triggered after the corresponding weak reference has been deleted with 
del (the weak reference is a value of a Python dict holding a node's 
attributes.)

I suspect that this is because of some batching or deferred processing in the 
Python interpreter.

Ultimately, this is a violation of the semantics and must be classified as a 
bug.

However, in my case, it would suffice to have a "memory barrier" type of 
operation that flushes the queue of deferred deletions before continuing.  
Something like that must exist, because single stepping in PDB is successful.

Initial tests of calling the garbage collector to this end were inconclusive, 
unfortunately.

--
components: Interpreter Core
messages: 387999
nosy: konrad.schwarz
priority: normal
severity: normal
status: open
title: imprecise handling of weakref callbacks
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



[issue43382] github CI blocked by the Ubuntu CI with an SSL error

2021-03-02 Thread Gregory P. Smith


New submission from Gregory P. Smith :

https://github.com/python/cpython/pull/20442/checks?check_run_id=2018900756

 ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca 
(_ssl.c:1122)
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local 
issuer certificate (_ssl.c:1122)
 ssl.SSLError: [SSL: SSLV3_ALERT_BAD_CERTIFICATE] sslv3 alert bad certificate 
(_ssl.c:1122)
 ssl.SSLError: [SSL] internal error (_ssl.c:1122)
 ssl.SSLError: [SSL] called a function you should not call (_ssl.c:1122)
 ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1122)
 ssl.SSLError: [SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:1122)
ssl.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error 
(_ssl.c:1122)
[SSL: NO_PROTOCOLS_AVAILABLE] no protocols available (_ssl.c:1122)

... and so on ...

This CI failure is preventing any PR from being merged.

Do we have a bad test certificate in the tree we need to update?
Or did some Ubuntu CI infrastructure just fall over and start rejecting a 
certificate it used to accept?

I believe this started around ~20210302T1500 UTC.

--
assignee: christian.heimes
components: Build, SSL, Tests
messages: 387998
nosy: christian.heimes, gregory.p.smith, lukasz.langa, ned.deily
priority: release blocker
severity: normal
status: open
title: github CI blocked by the Ubuntu CI with an SSL error
type: behavior
versions: Python 3.10, 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



Re: Why assert is not a function?

2021-03-02 Thread Chris Angelico
On Wed, Mar 3, 2021 at 2:06 PM Greg Ewing  wrote:
>
> On 3/03/21 12:24 pm, Chris Angelico wrote:
> > if PRODUCTION:
> >  def assert(*a, **kw): pass
> >
> > would work if it were a function :)
>
> But would cost you a useless function call for every assert
> in production mode.
>

A micro-optimization that would almost never actually impact your
code. But considering that I'm willing to keep *the entire check*
active, it's possible I'm slightly biased in favour of debuggability
at the cost of CPU...

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: editor recommendations?

2021-03-02 Thread Dan Stromberg
On Tue, Mar 2, 2021 at 8:00 PM Russell  wrote:

> Ethan Furman  wrote:
> > I'm currently using vim, and the primary reason I've stuck with it for
> so long is because I can get truly black screens with it.  By which I mean
> that I have a colorful window title bar, a light-grey menu bar, and then a
> light-grey frame around the text-editing window (aka the only window), and
> a nice, black-background editing area.
>
> I use vim. It's actually extremely powerful, especially for text/code
> editing. I'd recommend reading one of the many books on using vim
> effectively. Also, plugins can really add a lot...
>

On the subject of learning vim: There's an excellent vi cheat sheet
available on the internet.  I've put a copy of it at
https://stromberg.dnsalias.org/~strombrg/vi.ref.6

vi is of course the predecessor of vim. But that cheat sheet is still great
for learning much of vim.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43371] Mock.assert_has_calls works strange

2021-03-02 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



Re: editor recommendations?

2021-03-02 Thread Russell
Ethan Furman  wrote:
> I'm currently using vim, and the primary reason I've stuck with it for so 
> long is because I can get truly black screens with it.  By which I mean that 
> I have a colorful window title bar, a light-grey menu bar, and then a 
> light-grey frame around the text-editing window (aka the only window), and a 
> nice, black-background editing area.

I use vim. It's actually extremely powerful, especially for text/code
editing. I'd recommend reading one of the many books on using vim
effectively. Also, plugins can really add a lot...

-- 
rust
0x68caecc97f6a90122e51c0692c88d9cb6b58a3dc
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35935] threading.Event().wait() not interruptable with Ctrl-C on Windows

2021-03-02 Thread Eryk Sun


Eryk Sun  added the comment:

> But on this particular issue, making the unconditional wait be 
> interruptable by signals shouldn't be impossible.

PyThread_acquire_lock_timed() in Python/thread_nt.h currently ignores 
intr_flag. The current implementation calls EnterNonRecursiveMutex(), which in 
turn calls PyCOND_WAIT() / PyCOND_TIMEDWAIT() in Python/condvar.h. 
EnterNonRecursiveMutex() needs to support intr_flag and support a return value 
that indicates the wait was interrupted. PyThread_acquire_lock_timed() needs to 
handle this value by returning PY_LOCK_INTR.

When using emulated condition variables, a lock combines a semaphore and a 
critical section. Waiting on the semaphore can be integrated with the SIGINT 
event via WaitForMultipleObjects(). 

Here's a replacement for WaitForSingleObject() that integrates the SIGINT 
event, and supports long waits passed as a PY_TIMEOUT_T in microseconds (just 
for the sake of discussion; it's not rigorously tested code):

unsigned long
_Py_WaitForSingleObject(void *handle, PY_TIMEOUT_T microseconds,
int intr_flag)
{
DWORD result;
DWORD handle_count;
HANDLE handle_array[2];
HANDLE sigint_event = NULL;

LONGLONG timeout = -1;
ULONGLONG deadline = 0;

/* Store timeout in system time units of 100 ns. */
if (microseconds >= 0) {
QueryUnbiasedInterruptTime();
timeout = microseconds * 10;
deadline += timeout;
}

handle_count = 1;
handle_array[0] = (HANDLE)handle;

if (intr_flag) {
sigint_event = _PyOS_SigintEvent();
if (sigint_event) {
handle_array[handle_count++] = sigint_event;
ResetEvent(sigint_event);
}
}

do {
ULONGLONG now;
DWORD milliseconds;

if (timeout < 0) {
milliseconds = INFINITE;
} else if (timeout < INFINITE * 1) {
milliseconds = timeout / 1;
} else {
milliseconds = INFINITE - 1;
}

result = WaitForMultipleObjectsEx(
handle_count, handle_array, FALSE,
milliseconds, FALSE);

if (sigint_event && result == WAIT_OBJECT_0 + 1) {
/* Pretend that this was an alertable wait that
   was interrupted by a user-mode APC queued to
   the main thread by the C signal handler. It's
   not implemented that way, but it could be. */
result = STATUS_USER_APC;
}

if (result != WAIT_TIMEOUT) {
break;
}

QueryUnbiasedInterruptTime();
timeout = deadline - now;
} while (timeout >= 0);

return result;
}

If the wait returns STATUS_USER_APC, then the caller should call 
PyErr_CheckSignals(). intr_flag would presumably only be true when called from 
a thread that can handle signals, i.e. when _PyOS_IsMainThread() is true.

That said, if actual Windows condition variables are used (an alternate 
implementation in Python/condvar.h), then waiting is implemented via 
SleepConditionVariableSRW(). There's no way to integrate the SIGINT event with 
this wait, nor any documented way to cancel the wait from the console control 
thread. If this implementation is adopted, then maybe the few cases that 
require locks that support an interruptible wait can be implemented as a 
separate thread API.

--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.7

___
Python tracker 

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



[issue43378] Pattern Matching section in tutorial refers to | as or

2021-03-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Another other thought, PEP 634 defines "|" as being an "or-pattern", so it part 
of the spec:

  https://www.python.org/dev/peps/pep-0634/#or-patterns

--

___
Python tracker 

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



[issue43364] Add shortcut to enable UTF-8 mode in start menu.

2021-03-02 Thread Inada Naoki


Inada Naoki  added the comment:

> You can run "[WindowsFolder]System32\setx.exe" directly. It's not a shell 
> command.

Thank you. I will do.

> For modifying an environment variable, please clone the entire path MSI and 
> use an Environment element to update it. Should be a little simpler than that 
> one, because it's a constant.

How about having both? Shortcut menu is more accessible when user want to 
enable UTF-8 mode after they install Python. (e.g. they got troubled by 
UnicodeDecodeError and are adviced to enable UTF-8 mode).

> Alternatively, for this kind of policy option, it might be nice to set up 
> some common registry keys to define it. That is a function I've been thinking 
> about for enabling some security features (such as malware scanning), and it 
> mimics how Windows distributes its own configuration already. That'll take a 
> whole PEP, though, and I doubt I'll get it ready in time for 3.10 given the 
> other stuff I've got going on right now.

Registry is also discussed in the thread, but there are no consensus about 
adding new way to enable UTF-8 mode.
I conclude that we should promote existing way (i.e. envvar) and get feedback 
from users.

> So provided we adequately document that the setting may impact other versions 
> of Python besides the one being installed, and it's not enabled by default, 
> I'm okay with an MSI-based addable/removable setting for PYTHONUTF8.

--

___
Python tracker 

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



[issue43371] Mock.assert_has_calls works strange

2021-03-02 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



Re: Why assert is not a function?

2021-03-02 Thread Greg Ewing

On 3/03/21 12:24 pm, Chris Angelico wrote:

if PRODUCTION:
 def assert(*a, **kw): pass

would work if it were a function :)


But would cost you a useless function call for every assert
in production mode.

--
Greg

--
https://mail.python.org/mailman/listinfo/python-list


[issue43075] ReDoS in urllib.request

2021-03-02 Thread Zachary Ware


Change by Zachary Ware :


--
keywords: +patch

___
Python tracker 

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



[issue43075] ReDoS in urllib.request

2021-03-02 Thread Zachary Ware


Change by Zachary Ware :


--
keywords: +easy -easy (C), patch

___
Python tracker 

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



[issue43363] memcpy writes to wrong destination

2021-03-02 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Agreed, stack is a PyObject**, so adding an integer (pto_nargs) to the pointer 
(stack) is implicitly by multiples of sizeof(PyObject*). This is how pointer 
arithmetic works in all versions of C I'm aware of. The code is correct.

--
nosy: +josh.r
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



[issue43075] ReDoS in urllib.request

2021-03-02 Thread Éric Araujo

Change by Éric Araujo :


--
title: ReDoS in request -> ReDoS in urllib.request

___
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

2021-03-02 Thread Neil Schemenauer


Change by Neil Schemenauer :


--
pull_requests: +23492
pull_request: https://github.com/python/cpython/pull/24714

___
Python tracker 

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



[issue43372] ctypes: test_frozentable fails when make regen-frozen

2021-03-02 Thread Neil Schemenauer


Change by Neil Schemenauer :


--
pull_requests: +23491
pull_request: https://github.com/python/cpython/pull/24714

___
Python tracker 

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



[issue43378] Pattern Matching section in tutorial refers to | as or

2021-03-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This seems fine to me.   In pattern matching, it has both the meaning and 
pronunciation of "or":

case "this" | "that": ...

It has similar mean in the re module:

r'abc|def'

And it is also used the same way in typing:

   s: list | tuple

We've also long used it for sets:

   rich | tall   # People who are either rich OR tall  

Based on this, I don't there is any reason to suspect it will be confused with 
bitwise-or.

The only place the operator really isn't harmonious is with dicts where its 
meaning is "update" and where it isn't commutative.

--
nosy: +rhettinger

___
Python tracker 

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



[issue43380] Assigning function parameter to class attribute by the same name

2021-03-02 Thread jennydaman


jennydaman  added the comment:

Yes sorry that was a typo

--

___
Python tracker 

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



[issue43380] Assigning function parameter to class attribute by the same name

2021-03-02 Thread jennydaman


jennydaman  added the comment:

# Example

Consider these three examples, which are theoretically identical

```
a = 4

class A:
a = a

print(A.a)

def createB(b):
class B:
z = b
print(B.z)

createB(5)

def createD(d):
class D:
d = d
print(D.d)

createD(6)
```

## Expected Output

```
4
5
6
```

## Actual Output

```
4
5
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 2, in createD
  File "", line 3, in D
NameError: name 'd' is not defined
```

--

___
Python tracker 

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



[issue43380] Assigning function parameter to class attribute by the same name

2021-03-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

Was 
def createD(D):

supposed to be:
def createD(d):

?

Not that that changes your problem. I just want to understand the exact issue.

--
nosy: +eric.smith

___
Python tracker 

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



[issue43381] add small test for frozen module line number table

2021-03-02 Thread Neil Schemenauer


Change by Neil Schemenauer :


--
keywords: +patch
pull_requests: +23490
pull_request: https://github.com/python/cpython/pull/24712

___
Python tracker 

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



[issue43381] add small test for frozen module line number table

2021-03-02 Thread Neil Schemenauer


New submission from Neil Schemenauer :

In bug #43372, we didn't notice that the code for the __hello__ module was not 
re-generated.  Things seems to be okay but the line number table was corrupted. 
 It seems a good idea to add a small test to ensure that doesn't happen again.

I marked the test as CPython implementation specific.

--
components: Tests
messages: 387989
nosy: nascheme
priority: low
severity: normal
stage: patch review
status: open
title: add small test for frozen module line number table
type: enhancement

___
Python tracker 

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



[issue43075] ReDoS in request

2021-03-02 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
keywords: +easy (C)

___
Python tracker 

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



[issue43288] test_importlib failure due to missing skip() method

2021-03-02 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
assignee:  -> nascheme
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



[issue43049] Use io.IncrementalNewlineDecoder for doctest newline conversion

2021-03-02 Thread Peter Donis


Peter Donis  added the comment:

Thanks for merging!

--

___
Python tracker 

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



[issue43380] Assigning function parameter to class attribute by the same name

2021-03-02 Thread jennydaman


New submission from jennydaman :

# Example

Consider these three examples, which are theoretically identical

```
a = 4

class A:
a = a

print(A.a)

def createB(b):
class B:
z = b
print(B.z)

createB(5)

def createD(D):
class D:
d = d
print(D.d)

createD(6)
```

## Expected Output

```
4
5
6
```

## Actual Output

```
4
5
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 2, in createD
  File "", line 3, in D
NameError: name 'd' is not defined
```

--
components: Interpreter Core
messages: 387987
nosy: jennydaman
priority: normal
severity: normal
status: open
title: Assigning function parameter to class attribute by the same name
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue42994] Missing MIME types for opus, AAC, 3gpp and 3gpp2

2021-03-02 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

Thanks for the this contribution, Nathan.

--
assignee:  -> orsenthil
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



[issue42994] Missing MIME types for opus, AAC, 3gpp and 3gpp2

2021-03-02 Thread Senthil Kumaran


Senthil Kumaran  added the comment:


New changeset 3a87e562ea21a5083e9f168e02e8ec3e6611e167 by Nathan Beals in 
branch 'master':
bpo-42994: Add MIME types for opus, AAC, 3gpp and 3gpp2 (#24287)
https://github.com/python/cpython/commit/3a87e562ea21a5083e9f168e02e8ec3e6611e167


--
nosy: +orsenthil

___
Python tracker 

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



Re: Tkinter long-running window freezes

2021-03-02 Thread John O'Hagan
On Wed, 24 Feb 2021 22:35:32 +1100
John O'Hagan  wrote:

> Hi list
> 
> I have a 3.9 tkinter interface that displays data from an arbitrary
> number of threads, each of which runs for an arbitrary period of time.
> A frame opens in the root window when each thread starts and closes
> when it stops. Widgets in the frame and the root window control the
> thread and how the data is displayed.
> 
> This works well for several hours, but over time the root window
> becomes unresponsive and eventually freezes and goes grey. No error
> messages are produced in the terminal.
> 
> Here is some minimal, non-threaded code that reproduces the problem on
> my system (Xfce4 on Debian testing):
> 
> from tkinter import *
> from random import randint
> 
> root = Tk()
> 
> def display(label):
> label.destroy()
> label = Label(text=randint(0, 9))
> label.pack()
> root.after(100, display, label)
> 
> display(Label())
> mainloop()
>  
> This opens a tiny window that displays a random digit on a new label
> every .1 second. (Obviously I could do this by updating the text
> rather than recreating the label, but my real application has to
> destroy widgets and create new ones).
> 
> This works for 3-4 hours, but eventually the window freezes.


Thanks to those that replied to this.

To summarise my tentative and incomplete conclusions, it seems that
tkinter doesn't like a lot of widgets being created and destroyed in a
long running process and will/may eventually freeze if this is done,
for a reason I haven't been able to fathom. Tk internally keeps names
of all widgets created, and this will cause a slow memory-use increase
if not prevented by manually re-using widget names, but this is not the
cause of the freezing. 

Here is a simplified version of how I worked around the issue by
recycling widgets:

from tkinter import *

class WidgetHandler:
"Reuse tkinter widgets"

widget_cache = []

def __init__(self, main_window, *args):

self.datastream = MyDataStream(*args)

self.main_window = main_window
if self.widget_cache:
self.widget = self.widget_cache.pop()
self.clean(self.widget)
else:
self.widget = self.new_widget()
#add functionality to widgets, e.g:
self.widget.var.traceid = self.widget.var.trace('w', self.meth1)
self.widget.button.configure(command=self.meth2)
self.widget.button.pack()
#etc
self.widget.pack()

def clean(self, widget):
"Remove traces, clear text boxes, reset button states etc"
#e.g:
self.widget.var.trace_remove('write', var.traceid)
self.widget.button['state'] = 'normal'
#etc

def new_widget(self):
"Create widget and children without adding any commands, traces etc"
widget = Frame(self.main_window)
#e.g:
widget.var = StringVar()
widget.button = Checkbutton(widget, variable=widget.var)
#etc
return widget

def meth1(self, *e):
pass
#do something with self.datastream

def meth2(self):
pass
#do something else with self.datastream

#etc

def quit(self):
self.datastream.quit()
self.widget.pack_forget()
self.widget_cache.append(self.widget)



-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43355] __future__.annotations breaks inspect.signature()

2021-03-02 Thread Eric V. Smith

Eric V. Smith  added the comment:

Can you show the values of “expected” and “actual” for both the failures and 
successes?

--
nosy: +eric.smith

___
Python tracker 

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



Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Cameron Simpson
On 02Mar2021 15:06, Larry Martell  wrote:
>I discovered something new (to me) yesterday. Was writing a unit test
>for generator function and I found that none of the function got
>executed at all until I iterated on the return value.

Aye. Generators are lazy - they don't run at all until you ask for a 
value.

By contrast, this is unlike Go's goroutines, which are busy - they 
commence operation as soon as invoked and run until the first yield 
(channel put, I forget how it is spelled now). This can cause excessive 
CPU utilisation, but it handle for _fast_ production of results. Which 
is a primary goal in Go's design.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why assert is not a function?

2021-03-02 Thread Chris Angelico
On Wed, Mar 3, 2021 at 10:48 AM Hexamorph  wrote:
>
> Am 03.03.2021 um 00:24 schrieb Chris Angelico:
> > On Wed, Mar 3, 2021 at 10:22 AM Mirko via Python-list
> >  wrote:
> >>
> >> Am 02.03.2021 um 23:09 schrieb Stestagg:
> >>> Ignoring the question about this feature being particularly useful, it
> >>
> >> It is useful because "assert" is primarily (if not purely and
> >> exclusive) a debugging tool during development and testing.
> >>
> >> In production code you don't want any asserts, but logging. Having
> >> "assert" being a function would make it much harder to get rid of it
> >> in production code.
> >>
> >
> > Really?
>
> Yes.
>
> > if PRODUCTION:
> > def assert(*a, **kw): pass
> >
> > would work if it were a function :)
>
> With the "if PRODUCTION" being superfluously in the production code
> (not to mention the possible NameError otherwise).
>

Whatever method you have for determining whether you're in debug or
prod, you can use it to decide whether or not to create the function.
It's that easy.

That said, though... I prefer to keep my assertions in prod too.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why assert is not a function?

2021-03-02 Thread Hexamorph
Am 03.03.2021 um 00:24 schrieb Chris Angelico:
> On Wed, Mar 3, 2021 at 10:22 AM Mirko via Python-list
>  wrote:
>>
>> Am 02.03.2021 um 23:09 schrieb Stestagg:
>>> Ignoring the question about this feature being particularly useful, it
>>
>> It is useful because "assert" is primarily (if not purely and
>> exclusive) a debugging tool during development and testing.
>>
>> In production code you don't want any asserts, but logging. Having
>> "assert" being a function would make it much harder to get rid of it
>> in production code.
>>
>
> Really?

Yes.

> if PRODUCTION:
> def assert(*a, **kw): pass
>
> would work if it were a function :)

With the "if PRODUCTION" being superfluously in the production code
(not to mention the possible NameError otherwise).



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why assert is not a function?

2021-03-02 Thread Chris Angelico
On Wed, Mar 3, 2021 at 10:22 AM Mirko via Python-list
 wrote:
>
> Am 02.03.2021 um 23:09 schrieb Stestagg:
> > Ignoring the question about this feature being particularly useful, it
>
> It is useful because "assert" is primarily (if not purely and
> exclusive) a debugging tool during development and testing.
>
> In production code you don't want any asserts, but logging. Having
> "assert" being a function would make it much harder to get rid of it
> in production code.
>

Really?

if PRODUCTION:
def assert(*a, **kw): pass

would work if it were a function :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why assert is not a function?

2021-03-02 Thread Mirko via Python-list
Am 02.03.2021 um 23:09 schrieb Stestagg:
> Ignoring the question about this feature being particularly useful, it

It is useful because "assert" is primarily (if not purely and
exclusive) a debugging tool during development and testing.

In production code you don't want any asserts, but logging. Having
"assert" being a function would make it much harder to get rid of it
in production code.


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43284] Wrong windows build post version 2004

2021-03-02 Thread Steve Dower


Steve Dower  added the comment:

The reason to avoid the GetVersion API is that certain automatic 
compatibility modes will lie about what the version number is, and 
people complained that it was wrong (kind of like this complaint ;) ). 
Reading the version from a system DLL bypasses that risk.

If your aim is to check the version for API compatibility/behaviour, 
then GetVersion is exactly the right thing to use, because it'll be 
adapted to match any compatibility options that are in effect. However, 
the platform module is not for this purpose, but is for logging system 
information. So we read from kernel32.dll instead (which is, yes, a 
bootleg way of doing it).

Node.js has some fairly horrible ways of doing this stuff on Windows. I 
haven't looked into this one in particular, but if they're not using 
GetVersion it wouldn't surprise me if they're running "cmd /C ver" and 
reading the output (don't even get me started on the security risks of 
that).

The most correct way is to query the system information service via WMI 
(which I'm 99% sure is what msinfo32.exe does). However, that's a _big_ 
step up in complexity, which is why we've avoided doing it to date. It 
might be the only viable option here if Windows is getting this good at 
shipping incremental rebuilds.

--

___
Python tracker 

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



[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-03-02 Thread David Bolen


David Bolen  added the comment:

Yes, that was the idea (revert the PyDEBUG condition only); it sounds like 
everyone is on the same page.

I've been doing buildbot duties only for a while (no code contributions since 
long before the current process), so there may be a short delay while I figure 
out this newfangled PR thing...

--

___
Python tracker 

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



Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Larry Martell
On Tue, Mar 2, 2021 at 2:16 PM Chris Angelico  wrote:
>
> On Tue, Mar 2, 2021 at 5:51 AM Alan Gauld via Python-list
>  wrote:
> >
> > On 28/02/2021 00:17, Cameron Simpson wrote:
> >
> > > BUT... It also has a __iter__ value, which like any Box iterates over
> > > the subboxes. For MDAT that is implemented like this:
> > >
> > > def __iter__(self):
> > > yield from ()
> >
> > Sorry, a bit OT but I'm curious. I haven't seen
> > this before:
> >
> > yield from ()
> >
> > What is it doing?
> > What do the () represent in this context?
> >
>
> It's yielding all the elements in an empty tuple. Which is none of
> them, meaning that - for this simple example - iterating over the
> object will produce zero results.

I discovered something new (to me) yesterday. Was writing a unit test
for generator function and I found that none of the function got
executed at all until I iterated on the return value. It was blowing
my mind as I was debugging the test and had a BP set in the first line
of the function but it was not hit when I called the function.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Marco Sulla
On Mon, 1 Mar 2021 at 19:51, Alan Gauld via Python-list
 wrote:
> Sorry, a bit OT but I'm curious. I haven't seen
> this before:
>
> yield from ()
>
> What is it doing?
> What do the () represent in this context?

It's the empty tuple.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43372] ctypes: test_frozentable fails when make regen-frozen

2021-03-02 Thread Miro Hrončok

Miro Hrončok  added the comment:

When I run `PYTHON_FOR_REGEN=python3.10 make regen-frozen` with Python 
3.10.0a5, I get the same diff and the same problem.

When I run `PYTHON_FOR_REGEN=python3.9 make regen-frozen` with Python 3.9.2, I 
get no diff and no problem (similarly with Python 3.8.8).

--

___
Python tracker 

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



[issue42994] Missing MIME types for opus, AAC, 3gpp and 3gpp2

2021-03-02 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +barry, maxking, r.david.murray

___
Python tracker 

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



[issue43367] submodule of c-extension module is quirky

2021-03-02 Thread Sebastian Koslowski


Sebastian Koslowski  added the comment:

>>> import parent.child

first imports "parent" (successfully) but then fails, because the import code 
has no knowledge of were to find ".child". This is because 
a) the module "parent" is not marked as a package (hence the error message) 
b) even if it were a package, there is no (ext) module file to locate and load.

If you instead run

>> from parent import child

only "parent" is imported, and "child" is retrieved as an attribute - which it 
actually is. The import code itself will add such an attribute, too [1]. 
However, that is after the submodule was located and loaded. Attribute lookup 
on the parent is not part of the submodule import itself.

A (hacky) work-around would be to add an entry for "parent.child" in 
sys.modules. This prevents the import machinery from running. 

A (more) proper solution would be to mark "parent" as a package and install 
some importlib hooks. See [2] for an example from Cython-land. 

Finally there is PyImport_AppendInittab() [3], which could possibly be used to 
register "parent.child". I have never tried that. Even if this worked, it would 
be unsupported and probably not without side-effects.

[1] https://docs.python.org/3/reference/import.html#submodules
[2] 
https://stackoverflow.com/questions/30157363/collapse-multiple-submodules-to-one-cython-extension
[3] 
https://docs.python.org/3/c-api/import.html?highlight=inittab#c.PyImport_AppendInittab

--
nosy: +skoslowski

___
Python tracker 

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



[issue43364] Add shortcut to enable UTF-8 mode in start menu.

2021-03-02 Thread Steve Dower


Steve Dower  added the comment:

For modifying an environment variable, please clone the entire path MSI and use 
an Environment element to update it. Should be a little simpler than that one, 
because it's a constant.

I'm always very hesitant to modify system-wide (or user-wide) settings like 
this though. I'd be more comfortable if we made it a PYTHONUTF8_310 variable 
that _only_ applies to that specific version. Otherwise someone might install 
an update and break existing apps.

Alternatively, for this kind of policy option, it might be nice to set up some 
common registry keys to define it. That is a function I've been thinking about 
for enabling some security features (such as malware scanning), and it mimics 
how Windows distributes its own configuration already. That'll take a whole 
PEP, though, and I doubt I'll get it ready in time for 3.10 given the other 
stuff I've got going on right now.

So provided we adequately document that the setting may impact other versions 
of Python besides the one being installed, and it's not enabled by default, I'm 
okay with an MSI-based addable/removable setting for PYTHONUTF8.

--

___
Python tracker 

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



[issue43372] ctypes: test_frozentable fails when make regen-frozen

2021-03-02 Thread Miro Hrončok

Change by Miro Hrončok :


--
nosy: +nascheme

___
Python tracker 

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



[issue43284] Wrong windows build post version 2004

2021-03-02 Thread OrbitalHorizons


OrbitalHorizons  added the comment:

Node Js version of os wasnt affected. If this is having an issue then they used 
some bootleg method to fetch the build number in the first place.

--

___
Python tracker 

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



[issue43372] ctypes: test_frozentable fails when make regen-frozen

2021-03-02 Thread Miro Hrončok

New submission from Miro Hrončok :

The following test failure happens on Python 3.10.0a6+ when we make 
regen-frozen with the same Python version we test:

==
FAIL: test_frozentable (ctypes.test.test_values.PythonValuesTestCase)
--
Traceback (most recent call last):
  File 
"/home/churchyard/Dokumenty/RedHat/cpython/Lib/ctypes/test/test_values.py", 
line 87, in test_frozentable
self.assertEqual(items, expected, "PyImport_FrozenModules example "
AssertionError: Lists differ: [('__hello__', 129), ('__phello__', -129), 
('__phello__.spam', 129)] != [('__hello__', 125), ('__phello__', -125), 
('__phello__.spam', 125)]

First differing element 0:
('__hello__', 129)
('__hello__', 125)

- [('__hello__', 129), ('__phello__', -129), ('__phello__.spam', 129)]
?  ^ ^ ^

+ [('__hello__', 125), ('__phello__', -125), ('__phello__.spam', 125)]
?  ^ ^ ^
 : PyImport_FrozenModules example in Doc/library/ctypes.rst may be out of date

--
Ran 494 tests in 0.466s

FAILED (failures=1, skipped=87)


Reproducer:

1. Build Python from source: $ ./configure && make -j...
2. Run ctypes tests: $ ./python -m ctypes.test
3. Regenerate frozen: $ PYTHON_FOR_REGEN=./python make regen-frozen
4. Build Python from source again: $ ./configure && make -j...
5. Run ctypes tests: $ ./python -m ctypes.test

Actual result:

Tests in (2) pass, tests in (5) fail.

The difference after (3) is:

diff --git a/Python/frozen_hello.h b/Python/frozen_hello.h
index 9c566cc81e..d58b726aa8 100644
--- a/Python/frozen_hello.h
+++ b/Python/frozen_hello.h
@@ -9,5 +9,5 @@ static unsigned char M___hello__[] = {
 100,218,5,112,114,105,110,116,169,0,114,2,0,
 0,0,114,2,0,0,0,218,4,110,111,110,101,
 218,8,60,109,111,100,117,108,101,62,1,0,0,
-0,115,2,0,0,0,4,1,
+0,115,6,0,0,0,4,0,12,1,255,128,
 };


Expected results:

Tests pass, no diff.

--
components: Tests, ctypes
messages: 387933
nosy: hrnciar, hroncok
priority: normal
severity: normal
status: open
title: ctypes: test_frozentable fails when make regen-frozen
type: compile error
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



[issue43284] Wrong windows build post version 2004

2021-03-02 Thread bugale bugale


bugale bugale  added the comment:

Is there a good reason to not use GetVersionEx?

--

___
Python tracker 

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



[issue43284] Wrong windows build post version 2004

2021-03-02 Thread Steve Dower


Steve Dower  added the comment:

So somehow Windows made a rebuild *without* having to touch 
kernel32.dll, which is fairly impressive.

That version number comes from kernel32.dll, because there's no good way 
to get the build number via an API and also avoid compatibility settings 
lying about it.

I *guess* we need to find a better API for querying the current build 
number, hopefully without having to set up a whole WMI query.

--

___
Python tracker 

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



[issue39448] Add regen-frozen makefile target

2021-03-02 Thread Miro Hrončok

Miro Hrončok  added the comment:

I think something is broken with this, full report in: 
https://bugs.python.org/issue43372

--
nosy: +hroncok

___
Python tracker 

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



Python 3.10.0a6 is available, now with 100% more pattern matching

2021-03-02 Thread Pablo Galindo Salgado
Remember us? It's your friendly CPython release team and we have something
we think you may like: The new alpha release of Python 3.10 is here, now
with 100% more pattern matching. If I were you, I would download it and
start playing with it. Extra points if you report us any bugs you find
along the way! Are you confused about all this pattern matching business?
Fear not, this release also includes some fantastic documentation and some
shiny new "What's new" entries.

Check them here and tell us how we can improve it:

What's new: https://docs.python.org/3.10/whatsnew/3.10.html
Tutorial:
https://docs.python.org/3.10/tutorial/controlflow.html#match-statements

Go get the new alpha here:

https://www.python.org/downloads/release/python-3100a6/

**This is an early developer preview of Python 3.10**

# Major new features of the 3.10 series, compared to 3.9

Python 3.10 is still in development.  This release, 3.10.0a6 is the sixth
of seven planned alpha releases.
Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.
During the alpha phase, features may be added up until the start of the
beta phase (2021-05-03) and, if necessary, may be modified or deleted up
until the release candidate phase (2021-10-04).  Please keep in mind that
this is a preview release and its use is **not** recommended for production
environments.

Many new features for Python 3.10 are still being planned and written.
Among the new major
new features and changes so far:

* [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Remove wstr from
Unicode
* [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing
union types as X | Y
* [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter
Specification Variables
* [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line
numbers for debugging and other tools.
* [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import
annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) is now
the default.
* [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional
Length-Checking To zip.
* [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context
managers are now officially allowed.
* [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate
distutils module.
* [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type
Aliases
* [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural
Pattern Matching: Specification
* [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural
Pattern Matching: Motivation and Rationale
* [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural
Pattern Matching: Tutorial


* (Hey, **fellow core developer,** if a feature you find important
is missing from this list, [let Pablo know](mailto:pablog...@python.org
).)

The next pre-release of Python 3.10 will be 3.10.0a7 ( last alpha release),
currently scheduled for Monday, 2021-04-05.

# More resources

* [Online Documentation](https://docs.python.org/3.10/)
* [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release
Schedule
* Report bugs at [https://bugs.python.org](https://bugs.python.org).
* [Help fund Python and its community](/psf/donations/).

# And now for something completely different
Schwarzschild wormholes, also known as Einstein–Rosen bridges (named after
Albert Einstein and Nathan Rosen), are connections between areas of space
that can be modelled as vacuum solutions to the Einstein field equations,
and that are now understood to be intrinsic parts of the maximally extended
version of the Schwarzschild metric describing an eternal black hole with
no charge and no rotation. Here, "maximally extended" refers to the idea
that the spacetime should not have any "edges": it should be possible to
continue this path arbitrarily far into the particle's future or past for
any possible trajectory of a free-falling particle (following a geodesic in
the spacetime).

Although Schwarzschild wormholes are not traversable in both directions,
their existence inspired Kip Thorne to imagine traversable wormholes
created by holding the "throat" of a Schwarzschild wormhole open with
exotic matter (material that has negative mass/energy).

Regards from rainy London,

Pablo Galindo Salgado
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-03-02 Thread Steve Dower


Steve Dower  added the comment:

Hmm, yeah, it seems like the debug-specific definition has gone. Wonder when 
that happened.

In that case, go ahead and revert, but I'd suggest doing it by just removing 
the new Py_DEBUG condition rather than undoing all the changes. Should be 
nothing wrong with the rest of it.

IIRC, PR builds run under release because the compile-time increase is more 
than made up by the test time decrease.

--

___
Python tracker 

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



[issue43375] memory leak in threading ?

2021-03-02 Thread Mark Dickinson


Mark Dickinson  added the comment:

I'm not sure that this counts as a bug.

Each non-daemon thread adds a lock to the threading._shutdown_locks set: 
https://github.com/python/cpython/blob/8b795ab5541d8a4e69be4137dfdc207714270b77/Lib/threading.py#L933-L935.

That lock is removed when the thread is "join"ed: 
https://github.com/python/cpython/blob/8b795ab5541d8a4e69be4137dfdc207714270b77/Lib/threading.py#L988-L990

So the simple solution is to make sure that you always join your threads (which 
I'd expect normal code to do for non-daemon threads anyway), or to make your 
threads daemon threads.

--
nosy: +mark.dickinson

___
Python tracker 

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



Re: Why assert is not a function?

2021-03-02 Thread Barry


> On 2 Mar 2021, at 20:54, Marco Sulla  wrote:
> 
> I have a curiosity. Python, as many languages, has assert as a
> keyword. Can't it be implemented as a function? Is there an advantage
> to have it as a keyword?

assert condition, expression

Only is condition is false with expression be evaluated.
So you can safely do expensive things I the expression with incuring and cost 
if the condition is True.

With a function assert the 2nd part would have to evaluated regardless of the 
state of the condition.
Which would slow down the code for no benefit.

Barry

> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43371] Mock.assert_has_calls works strange

2021-03-02 Thread Dmitriy Mironiyk


New submission from Dmitriy Mironiyk :

I think that behavior of Mock.assert_has_calls is misleading. 
- When I call Mock.assert_has_calls with any_order=False it checks that 
expected calls are the same calls as performed on mock and raise an error if 
mock has some calls other than expected.
- When I call Mock.assert_has_calls with any_order=True it checks that mock has 
expected calls and not raise an error when mock has other calls than expected.

I suppose should be two separate methods:
- Mock.assert_has_only_calls that always raise an error when mock has calls 
other than expected(not regarding any_order).
- Mock.assert_has_calls that raise error only when no calls that provided in 
expected or if order of calls is wrong when any_order=False.

--
components: Tests
files: test_mock_asser_has_calls.py
messages: 387932
nosy: dmitriy.mironiyk
priority: normal
severity: normal
status: open
title: Mock.assert_has_calls works strange
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file49845/test_mock_asser_has_calls.py

___
Python tracker 

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



Python 3.10.0a6 is available, now with 100% more pattern matching

2021-03-02 Thread Pablo Galindo Salgado
Remember us? It's your friendly CPython release team and we have something
we think you may like: The new alpha release of Python 3.10 is here, now
with 100% more pattern matching. If I were you, I would download it and
start playing with it. Extra points if you report us any bugs you find
along the way! Are you confused about all this pattern matching business?
Fear not, this release also includes some fantastic documentation and some
shiny new "What's new" entries.

Check them here and tell us how we can improve it:

What's new: https://docs.python.org/3.10/whatsnew/3.10.html
Tutorial:
https://docs.python.org/3.10/tutorial/controlflow.html#match-statements

Go get the new alpha here:

https://www.python.org/downloads/release/python-3100a6/

**This is an early developer preview of Python 3.10**

# Major new features of the 3.10 series, compared to 3.9

Python 3.10 is still in development.  This release, 3.10.0a6 is the sixth
of seven planned alpha releases.
Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.
During the alpha phase, features may be added up until the start of the
beta phase (2021-05-03) and, if necessary, may be modified or deleted up
until the release candidate phase (2021-10-04).  Please keep in mind that
this is a preview release and its use is **not** recommended for production
environments.

Many new features for Python 3.10 are still being planned and written.
Among the new major
new features and changes so far:

* [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Remove wstr from
Unicode
* [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing
union types as X | Y
* [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter
Specification Variables
* [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line
numbers for debugging and other tools.
* [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import
annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) is now
the default.
* [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional
Length-Checking To zip.
* [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context
managers are now officially allowed.
* [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate
distutils module.
* [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type
Aliases
* [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural
Pattern Matching: Specification
* [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural
Pattern Matching: Motivation and Rationale
* [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural
Pattern Matching: Tutorial


* (Hey, **fellow core developer,** if a feature you find important
is missing from this list, [let Pablo know](mailto:pablog...@python.org
).)

The next pre-release of Python 3.10 will be 3.10.0a7 ( last alpha release),
currently scheduled for Monday, 2021-04-05.

# More resources

* [Online Documentation](https://docs.python.org/3.10/)
* [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release
Schedule
* Report bugs at [https://bugs.python.org](https://bugs.python.org).
* [Help fund Python and its community](/psf/donations/).

# And now for something completely different
Schwarzschild wormholes, also known as Einstein–Rosen bridges (named after
Albert Einstein and Nathan Rosen), are connections between areas of space
that can be modelled as vacuum solutions to the Einstein field equations,
and that are now understood to be intrinsic parts of the maximally extended
version of the Schwarzschild metric describing an eternal black hole with
no charge and no rotation. Here, "maximally extended" refers to the idea
that the spacetime should not have any "edges": it should be possible to
continue this path arbitrarily far into the particle's future or past for
any possible trajectory of a free-falling particle (following a geodesic in
the spacetime).

Although Schwarzschild wormholes are not traversable in both directions,
their existence inspired Kip Thorne to imagine traversable wormholes
created by holding the "throat" of a Schwarzschild wormhole open with
exotic matter (material that has negative mass/energy).

Regards from rainy London,

Pablo Galindo Salgado
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43284] Wrong windows build post version 2004

2021-03-02 Thread OrbitalHorizons


OrbitalHorizons  added the comment:

Running `platform.platform()` on Windows 10 21H1 results in the build number 
19041:

Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Windows-10-10.0.19041-SP0'
This is incorrect, the correct build number is 19043.

--
nosy: +Orbital
title: Wrong windows build in 20H2 -> Wrong windows build post version 2004
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



[issue40701] tempfile mixes str and bytes in an inconsistent manner

2021-03-02 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I clarified the documentation in the PR and added a regression test.

I chose to explicitly document that tempfile.tempdir may only be str or bytes 
and cannot be a path-like object.

We already document that people really should not set it and instead pass dir= 
to their APIs.  Now the docs make that more clear when it comes to setting it 
to a bytes object due to the global API return type change consequences.

I view this PR as cleaning up a partial misbehavior while preserving an API 
wart of it ever working in any manner when set to a bytes value.

getting rid of tempfile.tempdir entirely or preventing it from being a bytes 
value at all would be much more of a breaking change, even though desirable.  
Not a bugfix.  Now with the PR as is, we at least document that people should 
avoid doing that and make it clear what consistent behavior happens when they 
do it anyways.  With a test.

--

___
Python tracker 

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



Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Chris Angelico
On Tue, Mar 2, 2021 at 5:51 AM Alan Gauld via Python-list
 wrote:
>
> On 28/02/2021 00:17, Cameron Simpson wrote:
>
> > BUT... It also has a __iter__ value, which like any Box iterates over
> > the subboxes. For MDAT that is implemented like this:
> >
> > def __iter__(self):
> > yield from ()
>
> Sorry, a bit OT but I'm curious. I haven't seen
> this before:
>
> yield from ()
>
> What is it doing?
> What do the () represent in this context?
>

It's yielding all the elements in an empty tuple. Which is none of
them, meaning that - for this simple example - iterating over the
object will produce zero results.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43344] RotatingFileHandler breaks file type associations

2021-03-02 Thread Kevin Hollingshead


Kevin Hollingshead  added the comment:

Thanks Vinay, I was able to do this with:

def namer(name):
return name.replace(".log", "") + ".log"

Then when initializing the logger:

handler.namer = namer

My full initializer script:

import os
import logging
from logging.handlers import TimedRotatingFileHandler
from config import constants

def namer(name):
return name.replace(".log", "") + ".log"

def init(baseFilename):
logPath = constants.LOGGING_DIR
envSuffix = '-prod' if constants.ENV == 'prod' else '-dev'
logFilename = os.path.join(logPath, baseFilename + envSuffix + '.log')
print(f"Logging to {logFilename}")

handler = TimedRotatingFileHandler(logFilename,
when = "midnight",
backupCount = 30,
encoding = 'utf8')
handler.setLevel(logging.DEBUG)
handler.suffix = "%Y%m%d"
handler.namer = namer

formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s
[%(module)s:%(lineno)d]')
handler.setFormatter(formatter)

logging.basicConfig(
handlers = [handler],
format = '%(asctime)s %(levelname)s %(message)s
[%(module)s:%(lineno)d]',
level = logging.DEBUG,
datefmt = '%Y-%m-%d %H:%M:%S')

if __name__ == '__main__':
init('testing')
logging.error("ohai")
logging.debug("ohai debug")
logging.getLogger().handlers[0].doRollover()
logging.error("ohai next day")
logging.debug("ohai debug next day")

On Mon, Mar 1, 2021 at 8:13 AM Vinay Sajip  wrote:

>
> Vinay Sajip  added the comment:
>
> As per the documentation at
>
>
> https://docs.python.org/3/library/logging.handlers.html#logging.handlers.BaseRotatingHandler.namer
>
> You can set the handler's "namer" attribute to a callable that returns a
> computed name for the rotated file - this can be computed as per your
> requirements. The cookbook also has an entry about this:
>
>
> https://docs.python.org/3/howto/logging-cookbook.html#using-a-rotator-and-namer-to-customize-log-rotation-processing
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



Re: Why assert is not a function?

2021-03-02 Thread Stestagg
There is also the, I think seldom used, feature that calling python with
'-O' removes all assert statements at parse/compile time (I believe for
performance reasons)

So for example:

$ python -c 'assert False'
Traceback (most recent call last):
  File "", line 1, in 
AssertionError

But:

$ python -O -c 'assert False'
[no output]
$

Ignoring the question about this feature being particularly useful, it
would be much harder to implement if assert were a standard function (and
re-bindable), as the 'arguments' in the assert construct are not even
executed when '-O' is used (this is the performance gain):

$ python -O -c 'assert DoesNotExist'
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'DoesNotExist' is not defined

vs.

$ python -O -c 'assert DoesNotExist'
[no output]
$

so the compiler would have to do a lot of work to identify assert calls and
remove them.

Steve



On Tue, Mar 2, 2021 at 9:04 PM Chris Angelico  wrote:

> On Wed, Mar 3, 2021 at 7:53 AM Marco Sulla 
> wrote:
> >
> > I have a curiosity. Python, as many languages, has assert as a
> > keyword. Can't it be implemented as a function? Is there an advantage
> > to have it as a keyword?
>
> It could, but it would need some magic. A lot of test frameworks have
> their own set of assertions and you have to pick the one you want -
> for instance:
>
> assertEqual(x, y)
>
> instead of
>
> assert x == y
>
> The trouble is that, if you write a function for this, it will just
> get True or False, without any explanation of the cause - making it
> somewhat unhelpful when something goes wrong. To compensate, function
> equivalents inevitably have to have myriad types of assertions, where
> the language just needs one.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43374] Apple refuses apps written in Python

2021-03-02 Thread Ned Deily


Change by Ned Deily :


--
type: security -> 

___
Python tracker 

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



[issue43374] Apple refuses apps written in Python

2021-03-02 Thread Adrian

New submission from Adrian :

My company maintains several Python related projects, one of them being an 
application published for many years in the Mac App Store.

During the submittion of the last update for the app, we were refused by Apple 
to publish the software with the following reason:

Guideline 2.5.1 - Performance
Your app links against the following non-public framework(s):

• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libformw.5.dylib/_wadd_wchnstr
• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libformw.5.dylib/_wins_wch
• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libformw.5.dylib/_win_wch
• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libformw.5.dylib/_win_wchnstr
• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libformw.5.dylib/_win_wchnstr
• Contents/Frameworks/libpython3.9.dylib/___sprintf_chk
• Contents/Frameworks/libpython3.9.dylib/_posix_spawn
• Contents/Frameworks/libpython3.9.dylib/_posix_spawn_file_actions_addclose
• Contents/Frameworks/libpython3.9.dylib/_posix_spawn_file_actions_adddup2
• Contents/Frameworks/libpython3.9.dylib/_posix_spawn_file_actions_addopen
• Contents/Frameworks/libpython3.9.dylib/_posix_spawn_file_actions_destroy
• Contents/Frameworks/libpython3.9.dylib/_posix_spawn_file_actions_init
• Contents/Frameworks/libpython3.9.dylib/_posix_spawnattr_destroy
• Contents/Frameworks/libpython3.9.dylib/_posix_spawnattr_init
• Contents/Frameworks/libpython3.9.dylib/_posix_spawnattr_setflags
• Contents/Frameworks/libpython3.9.dylib/_posix_spawnattr_setpgroup
• Contents/Frameworks/libpython3.9.dylib/_posix_spawnattr_setsigdefault
• Contents/Frameworks/libpython3.9.dylib/_posix_spawnattr_setsigmask
• Contents/Frameworks/libpython3.9.dylib/_posix_spawnp
• Contents/Frameworks/libcrypto.1.1.dylib/___sprintf_chk
• Contents/Frameworks/libp11-kit.0.dylib/___sprintf_chk
• Contents/Frameworks/Python.framework/Versions/3.9/lib/libpanelw.5.dylib/_SP
• Contents/Frameworks/Python.framework/Versions/3.9/lib/libformw.5.dylib/_SP
• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libformw.5.dylib/___sprintf_chk
• Contents/Frameworks/libmpfr.6.dylib/___sprintf_chk
• Contents/Frameworks/libgnutls.30.dylib/___sprintf_chk
• Contents/Frameworks/libgnutls.30.dylib/_p11_kit_space_strdup
• Contents/Frameworks/libgnutls.30.dylib/_p11_kit_space_strlen
• Contents/Frameworks/libidn2.0.dylib/_sprintf
• Contents/Frameworks/libx264.157.dylib/___sprintf_chk
• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libcrypto.1.1.dylib/___sprintf_chk
• Contents/Frameworks/libssl.1.1.dylib/___sprintf_chk
• Contents/Frameworks/libxml2.2.dylib/___sprintf_chk
• Contents/Frameworks/Python.framework/Versions/3.9/Python/___sprintf_chk
• Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawn
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawn_file_actions_addclose
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawn_file_actions_adddup2
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawn_file_actions_addopen
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawn_file_actions_destroy
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawn_file_actions_init
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawnattr_destroy
• Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawnattr_init
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawnattr_setflags
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawnattr_setpgroup
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawnattr_setsigdefault
• 
Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawnattr_setsigmask
• Contents/Frameworks/Python.framework/Versions/3.9/Python/_posix_spawnp
• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libssl.1.1.dylib/___sprintf_chk
• Contents/Frameworks/libhogweed.6.dylib/_nettle_buffer_space
• Contents/Frameworks/libicui18n.67.dylib/_sprintf
• Contents/Frameworks/Python.framework/Versions/3.9/lib/libmenuw.5.dylib/_SP
• Contents/Frameworks/libavfilter.7.dylib/_avformat_match_stream_specifier
• Contents/Frameworks/libmpc.3.dylib/___sprintf_chk
• Contents/Frameworks/libunistring.2.dylib/___sprintf_chk
• Contents/Frameworks/libunistring.2.dylib/_sprintf
• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libpanelw.5.dylib/__nc_panelhook
• 
Contents/Frameworks/Python.framework/Versions/3.9/lib/libformw.5.dylib/__nc_wcrtomb

Next Steps

The use of non-public APIs is not permitted on the App Store as it can lead to 
a poor user experience should these APIs change.

--
components: C API, Interpreter Core, macOS
messages: 387947
nosy: adigeo, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Apple refuses apps written in Python
type: security
versions: Python 3.9

___
Python tracker 

Re: is not recognized as an internal or external command, operable program or batch file.

2021-03-02 Thread Roland Mueller via Python-list
Hello,
this is windows setup issue related to the fact that python binary is not
in execution path.

For setting up you may find instructions by searching for "windows 10 put
python to path". One result is following page:
https://superuser.com/questions/143119/how-do-i-add-python-to-the-windows-path





ma 1. maalisk. 2021 klo 20.54 singh.veer9--- via Python-list (
python-list@python.org) kirjoitti:

>Dear Sir/Madam
>
>Sir I am facing the issue from 10 days. And I tried all the ways to
> remove
>this or to come out of this problem
>but as i try to install some PYTEST or OPENPYXL packages using pip it
>gives the notification that there is no writeable path present due to
> that
>I am not “is not recognized as an internal or external command, operable
>program or batch file.”  I am facing problem in running the test cases
> in
>Pycharm for the PYTEST
>please help me pls
>
>
>
>
>
>Sent from [1]Mail for Windows 10
>
>
>
> References
>
>Visible links
>1. https://go.microsoft.com/fwlink/?LinkId=550986
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43373] Tensorflow

2021-03-02 Thread Mark Dickinson


Mark Dickinson  added the comment:

Hmm. Somehow the trailing dot became part of the second URL.

Trying again: https://github.com/tensorflow/tensorflow/issues/44485

--

___
Python tracker 

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



[issue43373] Tensorflow

2021-03-02 Thread Mark Dickinson


Mark Dickinson  added the comment:

Wrong tracker. Try https://github.com/tensorflow/tensorflow. (See in particular 
https://github.com/tensorflow/tensorflow/issues/44485.)

--
nosy: +mark.dickinson
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



Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Alan Gauld via Python-list
On 28/02/2021 23:47, Alan Gauld via Python-list wrote:
> On 28/02/2021 00:17, Cameron Simpson wrote:
> 
>> BUT... It also has a __iter__ value, which like any Box iterates over 
>> the subboxes. For MDAT that is implemented like this:
>>
>> def __iter__(self):
>> yield from ()
> 
> Sorry, a bit OT but I'm curious. I haven't seen
> this before:
> 
> yield from ()
> 
> What is it doing?
> What do the () represent in this context?
> 

Thanks for the replies.
I should have known better but I was thinking some
cleverness with callables and completely forgot
the empty tuple syntax. Oops!

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Chris Angelico
On Wed, Mar 3, 2021 at 8:21 AM Dieter Maurer  wrote:
>
> Alan Gauld wrote at 2021-2-28 23:47 +:
> >yield from ()
>
> "yield from iterator" is similar to "for i in iterator: yield i" (with
> special handling when data/exceptions are injected into the generator).
>
> Thus, "yield from ()" does essentially nothing with the side effect
> that the containing function is treated as generator function.
>

Another way to write the same thing is:

if False: yield None

This, too, will do nothing - in fact, it will be optimized out
completely in current versions of CPython - but, again, will force the
function to be a generator.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43374] Apple refuses apps written in Python

2021-03-02 Thread Adrian


Adrian  added the comment:

Hi Ned,

Yes, I have submitted Python apps to Mac App Store since 2009, for 12 years.

Each new push opens a new pandoras box with different questions asked than 
previously. There is no learning curve, is just walls with more walls behind 
each submission. The official reasoning behind all these controls is more 
security for end-users at the cost of less and less freedom for developers.

The app is a the result of the collaboration effort of many people and years of 
IETF works related to standards based real-time communications.

Two years ago we almost dropped the app because of almost impossible to solve 
issues raised by Apple. 

In the last year we spent many efforts to see if and how we can still comply 
with the more and more authoritarian demands of Apple to keep these works 
alive. 

I resigned myself to the thought that at some point we will hit a unsolvable 
issue, I just hope is not this one and now.

Adrian

> On 2 Mar 2021, at 18:36, Ned Deily  wrote:
> 
> 
> Ned Deily  added the comment:
> 
>> What am I suppose to do?
> 
> I appreciate that it's a nasty problem. Unfortunately, this is unknown 
> territory for me: I have no experience with the Mac App Store and this is the 
> first time I've run across a report like this. So the question again is: what 
> has changed? Were you able to successfully submit Python apps before? If so, 
> exactly what version worked and what version is failing now/ There are some 
> differences in how we have and are now building the Mac binaries for the 
> python.org installers.  But I'm working blind here.  Perhaps some other 
> people have experience with this.
> 
> --
> 
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue43373] Tensorflow

2021-03-02 Thread Gaming With Skytorrush


New submission from Gaming With Skytorrush :

I was unable to install Tensorflow via pip in python 3.9 but its working fine 
with 3.8

--
components: Library (Lib)
messages: 387944
nosy: clashwithchiefrpjyt
priority: normal
severity: normal
status: open
title: Tensorflow
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



[issue43379] Pasting multiple lines in the REPL is broken since 3.9

2021-03-02 Thread Romain Vincent


New submission from Romain Vincent :

DISCLAIMER: This is the first time I submit an issue here. In advance, my 
humble apologies if I missed something.
Feel free to correct me :)

--

I regularly test snippets of code by pasting them from a code editor to a shell 
REPL.

It works perfectly well in python 3.8 or 3.7 but not in python 3.9.

Demonstration:

Try to copy and paste the following simple snippet:

---

def f():
print("hello world")

---

The result in a python 3.8 REPL (same with 3.7):

---

$ python3.8
Python 3.8.6 (default, Nov 20 2020, 18:29:40)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
print("hello world")
>>> f()
hello world

---

But with python 3.9:

---

$ python3.9
Python 3.9.1 (default, Dec 10 2020, 10:36:35)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
print("hello world")
  File "", line 1

^
SyntaxError: multiple statements found while compiling a single statement

---

This behavior happens with any snippet of code containing at least one indented 
line, whether by tabs or spaces and whatever the number of spaces.


Regards.

--
components: IO
messages: 387976
nosy: romainfv
priority: normal
severity: normal
status: open
title: Pasting multiple lines in the REPL is broken since 3.9
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



[issue43375] memory leak in threading ?

2021-03-02 Thread Igor Mandrichenko


New submission from Igor Mandrichenko :

There is an apparent memory leak in threading. It looks like memory grows when 
I create, run and destroy threads. The memory keeps adding at the rate of about 
100 bytes per thread.

I am attaching the code, which works for Linux. getMemory() function is 
Linux-specific, it gets current process memory utilization

--
components: Extension Modules
files: memleak.py
messages: 387948
nosy: igorvm
priority: normal
severity: normal
status: open
title: memory leak in threading ?
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49846/memleak.py

___
Python tracker 

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



[issue20074] open() of read-write non-seekable streams broken

2021-03-02 Thread Ken Teh


Ken Teh  added the comment:

It works on macos but not on linux, ie, I have a usb-serial dongle connected to 
a serial device (a CAMAC controller), and I do an os.open() with 'wb+', 
followed by a io.fdopen().  I can talk to my device on macos BigSur 11.2, 
buffered, but not on Linux which throws the non-seekable error when I do the 
io.fdopen().

--
nosy: +ken.teh

___
Python tracker 

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



[issue43233] test_os: test_copy_file_range_offset fails on FreeBSD CURRENT

2021-03-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Buildbot is green! 
https://buildbot.python.org/all/#/builders/483/builds/841

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



[issue43374] Apple refuses apps written in Python

2021-03-02 Thread Ned Deily


Ned Deily  added the comment:

> What am I suppose to do?

I appreciate that it's a nasty problem. Unfortunately, this is unknown 
territory for me: I have no experience with the Mac App Store and this is the 
first time I've run across a report like this. So the question again is: what 
has changed? Were you able to successfully submit Python apps before? If so, 
exactly what version worked and what version is failing now/ There are some 
differences in how we have and are now building the Mac binaries for the 
python.org installers.  But I'm working blind here.  Perhaps some other people 
have experience with this.

--

___
Python tracker 

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



[issue23740] http.client request and send method have some datatype issues

2021-03-02 Thread Alex Willmer


Alex Willmer  added the comment:

First stab at characterising http.client.HTTPConnnection.send().

https://github.com/moreati/bpo-23740

This uses a webserver that returns request details, in the body of the 
response. Raw (TCP level) content is included. It shares a similar purpose to 
HTTP TRACE command. In principal the bytes that HTTPConection.send() writes 
will match to the bytes returned (after they're decapsulated from the JSON). 
I've not tested that aspect yet.

TODO
- further testing (verify round trip, bytes in = bytes out) 
- cover multiple Python versions
- cover cases such client manually setting Content-Length

--

___
Python tracker 

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



[issue43378] Pattern Matching section in tutorial refers to | as or

2021-03-02 Thread Luciano Ramalho

New submission from Luciano Ramalho :

Section 4.6. "match Statements" of the Python 3.10 tutorial says:

"""
You can combine several literals in a single pattern using | (“or”):
"""

For someone just learning Python, this may suggest that | is always "or", when 
in fact it is a bitwise operator (that may be overloaded), but inside a match 
clause has this special meaning without any overloading. 

I believe this exception should be made explicit in section 4.6, otherwise it 
may lead readers of the tutorial to a misconception.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
title: Pattern Matching section in tutorial refers to | as -> Pattern Matching 
section in tutorial refers to | as or
type:  -> enhancement
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



[issue43374] Apple refuses apps written in Python

2021-03-02 Thread Adrian

Adrian  added the comment:

Hi Ned,

I have a ticket opened with Apple. They refuse the software as it, they are in 
a position of absolute power, to reject and drop many years of work on a dime.

What am I suppose to do? I can fix my own software, but then there are 
dependencies like Python itself. Hence my question on this forum. I don’t 
expect miracles or people doing works for free for me to solve my problem. I 
think I am not the only one confronted with this problem, Python has a pretty 
large installed base. 

I am looking for practical suggestions.

Regards,
Adrian

> On 2 Mar 2021, at 18:20, Ned Deily  wrote:
> 
> 
> Ned Deily  added the comment:
> 
> BTW, if you haven't already, I would strongly suggest you ask on one of the 
> Apple Developer Forums. My first guess is that the App Store validation 
> process is trying to incorrectly apply rules to your local Python framework 
> (from the Python.org installed framework). But that's just a guess at this 
> point.
> 
> --
> 
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue43378] Pattern Matching section in tutorial refers to | as

2021-03-02 Thread Luciano Ramalho


Change by Luciano Ramalho :


--
nosy: ramalho
priority: normal
severity: normal
status: open
title: Pattern Matching section in tutorial refers to | as

___
Python tracker 

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



yield from () Was: Re: weirdness with list()

2021-03-02 Thread Dieter Maurer
Alan Gauld wrote at 2021-2-28 23:47 +:
>yield from ()

"yield from iterator" is similar to "for i in iterator: yield i" (with
special handling when data/exceptions are injected into the generator).

Thus, "yield from ()" does essentially nothing with the side effect
that the containing function is treated as generator function.



--
Dieter
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-03-02 Thread Steve Dower


Steve Dower  added the comment:

We already have a separate recursion limit for debug builds on Windows, so it's 
probably best all around to reduce that (if it's only recursion tests that are 
failing). That way, we won't forget to fix up debugging later if/when we fix 
recursion.

--

___
Python tracker 

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



[issue43374] Apple refuses apps written in Python

2021-03-02 Thread Ned Deily


Ned Deily  added the comment:

BTW, if you haven't already, I would strongly suggest you ask on one of the 
Apple Developer Forums. My first guess is that the App Store validation process 
is trying to incorrectly apply rules to your local Python framework (from the 
Python.org installed framework). But that's just a guess at this point.

--

___
Python tracker 

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



[issue42782] shutil.move creates a new directory even on failure

2021-03-02 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23489
pull_request: https://github.com/python/cpython/pull/24711

___
Python tracker 

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



[issue43060] Convert _decimal C API from pointer array to struct

2021-03-02 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> But converting the decimal c api may breaks the compatibility, because some 
> macros like `PyDec_TypeCheck_INDEX` have been exposed in headers.

True. Is there many external users of this API? I could not find any relevant 
examples using searchcode.com.

--

___
Python tracker 

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



[issue43367] submodule of c-extension module is quirky

2021-03-02 Thread Yannick Jadoul


Change by Yannick Jadoul :


--
nosy: +YannickJadoul

___
Python tracker 

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



[RELEASE] Python 3.10.0a6 is available, now with 100% more pattern matching

2021-03-02 Thread Pablo Galindo Salgado
Remember us? It's your friendly CPython release team and we have something
we think you may like: The new alpha release of Python 3.10 is here, now
with 100% more pattern matching. If I were you, I would download it and
start playing with it. Extra points if you report us any bugs you find
along the way! Are you confused about all this pattern matching business?
Fear not, this release also includes some fantastic documentation and some
shiny new "What's new" entries.

Check them here and tell us how we can improve it:

What's new: https://docs.python.org/3.10/whatsnew/3.10.html
Tutorial:
https://docs.python.org/3.10/tutorial/controlflow.html#match-statements

Go get the new alpha here:

https://www.python.org/downloads/release/python-3100a6/


*Note: The alpha was officially released yesterday, but my email client
failed to deliver this email to the mailing lists so I am reposting it.*
**This is an early developer preview of Python 3.10**

# Major new features of the 3.10 series, compared to 3.9

Python 3.10 is still in development.  This release, 3.10.0a6 is the sixth
of seven planned alpha releases.
Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.
During the alpha phase, features may be added up until the start of the
beta phase (2021-05-03) and, if necessary, may be modified or deleted up
until the release candidate phase (2021-10-04).  Please keep in mind that
this is a preview release and its use is **not** recommended for production
environments.

Many new features for Python 3.10 are still being planned and written.
Among the new major
new features and changes so far:

* [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Remove wstr from
Unicode
* [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing
union types as X | Y
* [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter
Specification Variables
* [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line
numbers for debugging and other tools.
* [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import
annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) is now
the default.
* [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional
Length-Checking To zip.
* [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context
managers are now officially allowed.
* [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate
distutils module.
* [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type
Aliases
* [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural
Pattern Matching: Specification
* [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural
Pattern Matching: Motivation and Rationale
* [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural
Pattern Matching: Tutorial

* (Hey, **fellow core developer,** if a feature you find important
is missing from this list, [let Pablo know](mailto:pablog...@python.org
).)

The next pre-release of Python 3.10 will be 3.10.0a7 ( last alpha release),
currently scheduled for Monday, 2021-04-05.

# More resources

* [Online Documentation](https://docs.python.org/3.10/)
* [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release
Schedule
* Report bugs at [https://bugs.python.org](https://bugs.python.org).
* [Help fund Python and its community](/psf/donations/).

# And now for something completely different
Schwarzschild wormholes, also known as Einstein–Rosen bridges (named after
Albert Einstein and Nathan Rosen), are connections between areas of space
that can be modelled as vacuum solutions to the Einstein field equations,
and that are now understood to be intrinsic parts of the maximally extended
version of the Schwarzschild metric describing an eternal black hole with
no charge and no rotation. Here, "maximally extended" refers to the idea
that the spacetime should not have any "edges": it should be possible to
continue this path arbitrarily far into the particle's future or past for
any possible trajectory of a free-falling particle (following a geodesic in
the spacetime).

Although Schwarzschild wormholes are not traversable in both directions,
their existence inspired Kip Thorne to imagine traversable wormholes
created by holding the "throat" of a Schwarzschild wormhole open with
exotic matter (material that has negative mass/energy).

Regards from rainy London,

Pablo Galindo Salgado
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-02 Thread Andre Roberge


Andre Roberge  added the comment:

I understand the challenge of reproducing the behaviour of the Python 
interpreter for this case. If it cannot be reproduced, then the documentation 
for 
https://docs.python.org/3/library/code.html#code.InteractiveConsole.interact 
and others on that page should probably be modified as it states that it 
"Closely emulate the interactive Python console."

--

___
Python tracker 

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



[issue43374] Apple refuses apps written in Python

2021-03-02 Thread Ned Deily


Ned Deily  added the comment:

Hmm, yours is the first report of this here that I'm aware of. I see other 
reports on the web of other non-Python projects running into similar problems. 
So one question is what has changed? Can you report the version info string of 
this Python? Have you previously successfully submitted apps using this 
particular build of Python 3.9? If not, can you say exactly which version of 
Python last worked for this?

--

___
Python tracker 

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



[issue43356] PyErr_SetInterrupt should have an equivalent that takes a signal number

2021-03-02 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
nosy: +neologix, vstinner

___
Python tracker 

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



[issue43364] Add shortcut to enable UTF-8 mode in start menu.

2021-03-02 Thread Eryk Sun


Eryk Sun  added the comment:

> `cmd.exe /c "SETX PYTHONUTF8 1

You can run "[WindowsFolder]System32\setx.exe" directly. It's not a shell 
command.

--
nosy: +eryksun

___
Python tracker 

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



[issue36480] .strip() unexpected output on Windows

2021-03-02 Thread Zachary Ware


Change by Zachary Ware :


Removed file: https://bugs.python.org/file49847/tac.eml

___
Python tracker 

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



  1   2   >