[issue42778] Add follow_symlinks=True parameter to both os.path.samefile() and Path.samefile()

2020-12-28 Thread Tom Hale


Tom Hale  added the comment:

In summary:

The underlying os.stat() takes a follow_symlinks=True parameter but it can't be 
set to False when trying to samefile() two symbolic links.

--
title: Add follow_symlinks=True to {os.path,Path}.samefile -> Add 
follow_symlinks=True parameter to both os.path.samefile() and Path.samefile()

___
Python tracker 

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



[issue42778] Add follow_symlinks=True to {os.path,Path}.samefile

2020-12-28 Thread Tom Hale


New submission from Tom Hale :

The os.path and Path implementations of samefile() do not allow comparisons of 
symbolic links:

% mkdir empty && chdir empty
% ln -s non-existant broken
% ln broken lnbroken
% ls -i # Show inode numbers
19325632 broken@  19325632 lnbroken@
% Yup, they are the same file... but...
% python -c 'import os; print(os.path.samefile("lnbroken", "broken", 
follow_symlinks=False))'
Traceback (most recent call last):
  File "", line 1, in 
TypeError: samefile() got an unexpected keyword argument 'follow_symlinks'
% python -c 'import os; print(os.path.samefile("lnbroken", "broken"))'
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.8/genericpath.py", line 100, in samefile
s1 = os.stat(f1)
FileNotFoundError: [Errno 2] No such file or directory: 'lnbroken'
%

Both samefile()s use os.stat under the hood, but neither allow setting  
os.stat()'s `follow_symlinks` parameter.

https://docs.python.org/3/library/os.html#os.stat

https://docs.python.org/3/library/os.path.html#os.path.samefile

https://docs.python.org/3/library/pathlib.html#pathlib.Path.samefile

--
components: Library (Lib)
messages: 383965
nosy: Tom Hale
priority: normal
severity: normal
status: open
title: Add follow_symlinks=True to {os.path,Path}.samefile
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



[issue42560] Improve Tkinter Documentation

2020-12-28 Thread FredInChina


FredInChina  added the comment:

I agree with @MasonGinter, the documentation is somewhat lacking. Relying on 
third parties is fragile - we were fortunate that the University of New Mexico 
Tech docs maintained by Pr. John W. Shipman were 
[salvaged](https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/index.html) 
after his premature death; yet, some important example files were lost.

We now see [effbot.org](effbot.org) "taking a leave"... What other warnings do 
we need?


> "we don't know what Tk version to write them for".  
I don't understand why @epaine; shouldn't the docs be made available for the 
currently maintained version of python?

--
nosy: +ReblochonMasque

___
Python tracker 

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



ANN: NumExpr 2.7.2

2020-12-28 Thread Robert McLeod

Announcing NumExpr 2.7.2


Hi everyone,

It's been awhile since the last update to NumExpr, mostly as the existing
scientific
Python tool chain for building wheels on PyPi became defunct and we have
had to
redevelop a new one based on `cibuildwheel` and GitHub Actions. This
release also
brings us support (and wheels for) Python 3.9.

There have been a number of changes to enhance how NumExpr works when NumPy
uses MKL as a backend.

Project documentation is available at:

http://numexpr.readthedocs.io/

Changes from 2.7.1 to 2.7.2
---

- Support for Python 2.7 and 3.5 is deprecated and will be discontinued
when
  `cibuildwheels` and/or GitHub Actions no longer support these versions.
- Wheels are now provided for Python 3.7, 3.5, 3.6, 3.7, 3.8, and 3.9 via
  GitHub Actions.
- The block size is now exported into the namespace as
`numexpr.__BLOCK_SIZE1__`
  as a read-only value.
- If using MKL, the number of threads for VML is no longer forced to 1 on
loading
  the module. Testing has shown that VML never runs in multi-threaded mode
for
  the default BLOCKSIZE1 of 1024 elements, and forcing to 1 can have
deleterious
  effects on NumPy functions when built with MKL. See issue #355 for
details.
- Use of `ndarray.tostring()` in tests has been switch to
`ndarray.tobytes()`
  for future-proofing deprecation of `.tostring()`, if the version of NumPy
is
  greater than 1.9.
- Added a utility method `get_num_threads` that returns the (maximum)
number of
  threads currently in use by the virtual machine. The functionality of
  `set_num_threads` whereby it returns the previous value has been
deprecated
  and will be removed in 2.8.X.

What's Numexpr?
---

Numexpr is a fast numerical expression evaluator for NumPy.  With it,
expressions that operate on arrays (like "3*a+4*b") are accelerated
and use less memory than doing the same calculation in Python.

It has multi-threaded capabilities, as well as support for Intel's
MKL (Math Kernel Library), which allows an extremely fast evaluation
of transcendental functions (sin, cos, tan, exp, log...) while
squeezing the last drop of performance out of your multi-core
processors.  Look here for a some benchmarks of numexpr using MKL:

https://github.com/pydata/numexpr/wiki/NumexprMKL

Its only dependency is NumPy (MKL is optional), so it works well as an
easy-to-deploy, easy-to-use, computational engine for projects that
don't want to adopt other solutions requiring more heavy dependencies.

Where I can find Numexpr?
-

The project is hosted at GitHub in:

https://github.com/pydata/numexpr

You can get the packages from PyPI as well (but not for RC releases):

http://pypi.python.org/pypi/numexpr

Documentation is hosted at:

http://numexpr.readthedocs.io/en/latest/

Share your experience
-

Let us know of any bugs, suggestions, gripes, kudos, etc. you may
have.

Enjoy data!


-- 
Robert McLeod
robbmcl...@gmail.com
robert.mcl...@hitachi-hhtc.ca
___
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


[issue7057] tkinter doc: more 3.x updates

2020-12-28 Thread FredInChina


FredInChina  added the comment:

Are there good reasons not to close this issue?
It is marked as "easy", but it seems that the problems in reference have either 
been fixed, or died of old age.

--
nosy: +ReblochonMasque

___
Python tracker 

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



[issue42775] __init_subclass__ should be called in __init__

2020-12-28 Thread Ethan Furman


Ethan Furman  added the comment:

Guido, I just wanted to get it all in place while it was fresh in my mind.  
Actual code tends to make a discussion easier.  I'll make sure and transcribe 
any relevant discussion from python-dev to here.

--

___
Python tracker 

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



[issue42776] The string find method shows the problem

2020-12-28 Thread ye andy

ye andy  added the comment:

When I say True here, I'm not talking about querying, I'm talking about
syntax, as far as I know, document is supposed to support keyword
arguments, but it doesn't

Steven D'Aprano  于2020年12月29日周二 上午11:36写道:

>
> Steven D'Aprano  added the comment:
>
> # True
> data.find('a', 0)
>
> That will return 0, not True.
>
>
> # False
> data.find('a', start=0)
>
>
> And that will raise TypeError, not return False.
>
>
> What exactly are you reporting here? I have read your bug report, and
> looked at the screen shot, and I have no idea what problem you think you
> have found or what you want to change about the documentation.
>
> --
> nosy: +steven.daprano
>
> ___
> Python tracker 
> 
> ___
>

--
nosy: +andy.ye.jx

___
Python tracker 

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



[issue42775] __init_subclass__ should be called in __init__

2020-12-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

Whoa, you start a discussion on python-dev and another on bpo? That sounds a 
bit hasty.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue42775] __init_subclass__ should be called in __init__

2020-12-28 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +22829
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23986

___
Python tracker 

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



[issue42775] __init_subclass__ should be called in __init__

2020-12-28 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread Zachary Ware


Zachary Ware  added the comment:

Thanks for the report, bazwal; for the patch, Zackery; and for the ping Ammar :)

--
nosy: +zach.ware
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type: enhancement -> behavior

___
Python tracker 

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



[issue8595] Explain the default timeout in http-client-related libraries

2020-12-28 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
assignee: docs@python -> orsenthil
versions: +Python 3.10 -Python 2.6, Python 2.7, Python 3.1

___
Python tracker 

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



[issue8481] doc: ctypes no need to explicitly allocate writable memory with Structure

2020-12-28 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

This is a not a bug, it asks for parameter types to explained. API 
documentation reference should provide the guidance.

--
nosy: +orsenthil
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed
versions: +Python 3.10 -Python 2.6, Python 2.7

___
Python tracker 

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



[issue8822] datetime naive and aware types should have a well-defined definition that can be cross-referenced

2020-12-28 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
versions: +Python 3.10 -Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue1398781] Example in section 5.3 "Pure Embedding" doesn't work.

2020-12-28 Thread Senthil Kumaran


Change by Senthil Kumaran :


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

___
Python tracker 

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



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread miss-islington


miss-islington  added the comment:


New changeset 0b43778b3cd222761beb850178492b6bd0ea2370 by Miss Islington (bot) 
in branch '3.9':
bpo-42770: Fix a typo in the email.headerregistry docs (GH-23982)
https://github.com/python/cpython/commit/0b43778b3cd222761beb850178492b6bd0ea2370


--

___
Python tracker 

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



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread miss-islington


miss-islington  added the comment:


New changeset e11639880a73f30b4009efa8d14c350932e35332 by Miss Islington (bot) 
in branch '3.8':
bpo-42770: Fix a typo in the email.headerregistry docs (GH-23982)
https://github.com/python/cpython/commit/e11639880a73f30b4009efa8d14c350932e35332


--

___
Python tracker 

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



[issue42777] WindowsPath does not implement is_mount but ntpath implements and offers a ismount method

2020-12-28 Thread David


New submission from David :

pathlib.WindowsPath[0] does not implement is_mount but ntpath implements and 
offers a ismount[1] method. Perhaps WindowsPath is_mount can make use of 
ntpath.ismount ?



[0] https://github.com/python/cpython/blob/master/Lib/pathlib.py#L1578
[1] https://github.com/python/cpython/blob/master/Lib/ntpath.py#L248

--
messages: 383955
nosy: db
priority: normal
severity: normal
status: open
title: WindowsPath does not implement is_mount but ntpath implements and offers 
a ismount method

___
Python tracker 

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



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22827
pull_request: https://github.com/python/cpython/pull/23984

___
Python tracker 

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



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22828
pull_request: https://github.com/python/cpython/pull/23985

___
Python tracker 

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



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread miss-islington


miss-islington  added the comment:


New changeset c56988b88fecf6dc70f039704fda6051a0754db1 by Zackery Spytz in 
branch 'master':
bpo-42770: Fix a typo in the email.headerregistry docs (GH-23982)
https://github.com/python/cpython/commit/c56988b88fecf6dc70f039704fda6051a0754db1


--
nosy: +miss-islington

___
Python tracker 

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



[issue42717] The python interpreter crashed with "_enter_buffered_busy"

2020-12-28 Thread Xinmeng Xia


Xinmeng Xia  added the comment:

Could we try to limit the number of thread or state or something? I mean if we 
set parameter of "range", for example, to 1000 or less here, the crash will no 
longer happen. I think the parser can not handle too heavy loop so that it 
crashes.

--

___
Python tracker 

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



[issue42763] Exposing a race in the "_warnings" resulting Python parser crash

2020-12-28 Thread Xinmeng Xia


Xinmeng Xia  added the comment:

Thank you, but I don't think this is a duplicate of issue42717. This crash is 
probably caused by the parameter "target" of Thread. "Target" accept the 
"callable object". Defaults to None. In this program, it's assigned to a "Int 
object". I think a pre-checking of parameter for such error should be added. 



Minimal test case should be:
===
import threading
for i in range(10):
t = threading.Thread(target=1, daemon=True).start()  
= 



In fact, I try this one. No loop, It sometime crashes the parser.(not always, 
twice in ten times)
==
import threading
t = threading.Thread(target=1, daemon=True).start()
==

--

___
Python tracker 

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



[issue42776] The string find method shows the problem

2020-12-28 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

# True
data.find('a', 0)

That will return 0, not True.


# False
data.find('a', start=0)


And that will raise TypeError, not return False.


What exactly are you reporting here? I have read your bug report, and looked at 
the screen shot, and I have no idea what problem you think you have found or 
what you want to change about the documentation.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue42762] infinite loop resulted by "yield"

2020-12-28 Thread Xinmeng Xia


Xinmeng Xia  added the comment:

Thanks for your kind explanation! My description is a little confusing. Sorry 
about that. The problem here is that the program should stop when the exception 
is caught whatever the exception is. (I think bpo-25612 (#1773) fixed exception 
selection problems and right exception can be caught) The fact is this program 
will fall into an infinite loop. Error messages are printed in a dead loop. The 
program doesn't stop. This is not normal. There will be no loops in Python 3.5 
and 3.6 (Attached output in Python 3.5 and 3.6). 

 

Output on Python 3.5,3.6 (all errors are printed without any loop )
-
Exception ignored in: 
RuntimeError: generator ignored GeneratorExit
Traceback (most recent call last):
  File "/home/xxm/Desktop/nameChanging/report/test1.py", line 248, in 
print(i)
NameError: name 'i' is not defined
Exception ignored in: 
RuntimeError: generator ignored GeneratorExit
Exception ignored in: 
RuntimeError: generator ignored GeneratorExit


--

___
Python tracker 

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



[issue42776] The string find method shows the problem

2020-12-28 Thread andy ye

New submission from andy ye :

data = 'abcddd'
# True
data.find('a', 0)

# False
data.find('a', start=0)


# document
class str(obj):

def find(self, sub, start=None, end=None): # real signature unknown; 
restored from __doc__
"""
S.find(sub[, start[, end]]) -> int

Return the lowest index in S where substring sub is found,
such that sub is contained within S[start:end].  Optional
arguments start and end are interpreted as in slice notation.

Return -1 on failure.
"""
return 0

--
assignee: docs@python
components: Documentation
files: 截屏2020-12-29 上午10.57.53.png
messages: 383949
nosy: andyye, docs@python
priority: normal
severity: normal
status: open
title: The string find method shows the problem
versions: Python 3.6
Added file: https://bugs.python.org/file49704/截屏2020-12-29 上午10.57.53.png

___
Python tracker 

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



[issue42775] __init_subclass__ should be called in __init__

2020-12-28 Thread Ethan Furman


Ethan Furman  added the comment:

My understanding of using keywords in class headers

  class MyClass(SomeBaseClass, setting='maybe'):
...

is that the keywords would get passed into the super classes 
`__init_subclass__`  (`SomeBaseClass` and `setting`).

However, in the cases of 

- test_descr.py
- test_py_compile.py
- typing.py

that wasn't happening -- until the initial patch of moving the calls from 
`type.__new__` to `type.__init__`.

An `__init__` has been added in those three locations to discard the keyword 
arguments being passed in.

--
nosy: +rhettinger, stutzbach

___
Python tracker 

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



[issue42775] __init_subclass__ should be called in __init__

2020-12-28 Thread Ethan Furman


New submission from Ethan Furman :

PEP 487 introduced __init_subclass__ and __set_name__, and both of those were 
wins for the common cases of metaclass usage.

Unfortunately, the implementation of PEP 487 with regards to __init_subclass__ 
has made the writing of correct metaclasses significantly harder, if not 
impossible.

The cause is that when a metaclass calls type.__new__ to actually create the 
class, type.__new__ calls the __init_subclass__ methods of the new class' 
parents, passing it the newly created, but incomplete, class.  In code:

```
class Meta(type):
#
def __new__(mcls, name, bases, namespace, **kwds):
# create new class, which will call __init_subclass__ and __set_name__
new_class = type.__new__(mcls, name, bases, namespace, **kwds)
# finish setting up class
new_class.some_attr = 9
```

As you can deduce, when the parent __init_subclass__ is called with the new 
class, `some_attr` has not been added yet -- the new class is incomplete.

For Enum, this means that __init_subclass__ doesn't have access to the new 
Enum's members (they haven't beet added yet).

For ABC, this means that __init_subclass__ doesn't have access to 
__abstract_methods__ (it hasn't been created yet).

Because Enum is pure Python code I was able to work around it:
- remove new __init_subclass__ (if it exists)
- insert dummy class with a no-op __init_subclass__
- call type.__new__
- save any actual __init_subclass__
- add back any new __init_subclass__
- rewrite the new class' __bases__, removing the no-op dummy class
- finish creating the class
- call the parent __init_subclass__ with the now complete Enum class

I have not been able to work around the problem for ABC.

The solution would seem to be to move the calls to __init_subclass__ and 
__set_names__ to type.__init__.

--
assignee: ethan.furman
components: Interpreter Core
messages: 383946
nosy: ethan.furman, serhiy.storchaka
priority: high
severity: normal
stage: needs patch
status: open
title: __init_subclass__ should be called in __init__
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue35815] Able to instantiate a subclass with abstract methods from __init_subclass__ of the ABC

2020-12-28 Thread Ethan Furman


Ethan Furman  added the comment:

If the patch in issue42775 is committed, this problem will be solved.

--
assignee:  -> ethan.furman
superseder:  -> __init_subclass__ should be called in __init__

___
Python tracker 

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



asyncio cancellation pattern

2020-12-28 Thread Joseph L. Casale
I've started writing some asyncio code in lieu of using threads and
managing concurrency and primitives manually.

Having spent a lot of time using c#'s async implementation, I am struggling
to see an elegant pattern for implementing cancellation. With the necessity
for the loop (that of which I understand) and the disconnect between
context and tasks, how does one act on a failure within a task and invoke
cancellation upwards.

Collecting all tasks and cancelling everything is not appropriate, they may
not necessarily all be part of the graph that needs cancelling.

In c#, we have several patterns available using a cancellation token source
and either passing the token (event only) into the task, or the token source
into the task execution context for signaling during a failure.

Does an easier way then manually creating tasks from coroutines and
tracking them explicitly exist?

Thanks,
jlc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Which method to check if string index is queal to character.

2020-12-28 Thread Bischoop
On 2020-12-28, Michael Torrie  wrote:
> On 12/28/20 10:46 AM, Marco Sulla wrote:
>> On Mon, 28 Dec 2020 at 17:37, Bischoop  wrote:
>>>
>>> I'd like to check if there's "@" in a string and wondering if any method
>>> is better/safer than others. I was told on one occasion that I should
>>> use is than ==, so how would be on this example.
>>>
>>> s = 't...@mail.is'
>> 
>> You could do simply
>> 
>> if "@" in s:
>> 
>> but probably what you really want is a regular expression.
>
> https://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx/
>

Interested article.

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


[issue42740] typing.py get_args and get_origin should support PEP 604 and 612

2020-12-28 Thread Guido van Rossum


Change by Guido van Rossum :


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



[issue42740] typing.py get_args and get_origin should support PEP 604 and 612

2020-12-28 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset efb1f0918fad2ba3346a986b0e958dc5753a7bbe by Ken Jin in branch 
'master':
bpo-42740: Support PEP 604, 612 for typing.py get_args and get_origin (GH-23942)
https://github.com/python/cpython/commit/efb1f0918fad2ba3346a986b0e958dc5753a7bbe


--

___
Python tracker 

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



Re: Which method to check if string index is queal to character.

2020-12-28 Thread Richard Damon
On 12/28/20 8:02 PM, Chris Angelico wrote:
>
> Yes, many such regexes exist, and they are *all wrong*. Without
> exception. I don't think it's actually possible for a regex to
> perfectly match all (syntactically) valid email addresses and nothing
> else.
>
> ChrisA

Since Email addresses are allowed to have (comments) in them, and
comments are allowed to nest, I think it takes something stronger than a
regex to fully process them, but takes something that can handle a
recursive grammar.

I think that is the only thing that absolutely prevents using a regex
(but not sure about it) but some of the rules will make things messy and
need to use alternation and repetition.

The one other thing that might block a regex is I think there is an
upper limits to how long the address (or its parts) are allowed to be,
and testing that at the same time as the other patterns is probably
beyond what a regex could handle.

-- 
Richard Damon

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


Re: Which method to check if string index is queal to character.

2020-12-28 Thread Bischoop
On 2020-12-28, Mats Wichmann  wrote:
> On 12/28/20 10:46 AM, Marco Sulla wrote:
>> On Mon, 28 Dec 2020 at 17:37, Bischoop  wrote:
>>>
>>> I'd like to check if there's "@" in a string and wondering if any method
>>> is better/safer than others. I was told on one occasion that I should
>>> use is than ==, so how would be on this example.
>>>
>>> s = 't...@mail.is'
>> 
>> You could do simply
>> 
>> if "@" in s:
>> 
>> but probably what you really want is a regular expression.
>> 
>
> Will add that Yes, you should always validate your inputs, but No, the 
> presence of an @ sign in a text string is not sufficient to know it's a 
> valid email address. Unfortunately validating that is hard.
>

Nah, by saying if is valid I meant exeactly if there's "@", I could add
yet if endswith() but at this point @ is enough. 
Yes the only possible way for full validation would be just sending
email and waiting for reply.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42774] 'ipaddress' module, bad result for 'is_private' on "192.0.0.0"

2020-12-28 Thread Trevor Marvin


Change by Trevor Marvin :


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



RE: Which method to check if string index is queal to character.

2020-12-28 Thread Avi Gross via Python-list
Thanks, Chris,

I am not actually up-to-date on such messaging issues but not shocked at
what you wrote. Years ago I recall most messages going out of my workplace
looked like machine!machine2!ihnp4!more!evenmore!user with no @ in sight and
as you mention, you may want to send to a domain and have it send to a
subdomain so a multiple @ may make sense and so on. I note we have some
places like groups.io that disguise the @ in your original email address so
you can still see who it is from, even though it is in some sense from them
but to actually use the email address in your own mailer, you need to
substitute it back in. 

I think we all agree that unless there is further standardization, an email
address can easily be rejected that is otherwise usable in some context and
that one in proper format (by some definition) will fail in that context.

The original question actually focused more narrowly on a good way to find
if a character existed in a string for which regular expressions need not
apply and most email addresses re short enough that techniques to speed up
the search may not be useful unless all the program does is search millions
of email addresses for the presence.

Dropping out, ...

-Original Message-
From: Python-list  On
Behalf Of Chris Angelico
Sent: Monday, December 28, 2020 8:02 PM
To: Python 
Subject: Re: Which method to check if string index is queal to character.

On Tue, Dec 29, 2020 at 10:08 AM Avi Gross via Python-list
 wrote:
>
> This may be a nit, but can we agree all valid email addresses as used 
> today have more than an @ symbol?
>
> I see it as requiring at least one character before the @ that come 
> from a list of allowed characters (perhaps not ASCII) but does not 
> include the symbol @ again. It is normally followed by some minimal 
> number of characters and maybe  a period and one of the currently 
> valid domains like .com or .it but the latter gets tricky as it can 
> look like u...@abd.def.att.com or other long variations where only the 
> final component must be testable in the program.

There can be an @ in the first part of the address, and the domain may well
not have a dot.

> The lack of an at-sign suggests it is not an email address. The lack 
> of anything before or after also seems to disqualify it. You may be 
> able to add more conditions but as noted, having more than one at-sign 
> may also disqualify it.

Lack of an at sign means it's a local address that can't be routed over the
internet, and in many contexts, it's reasonable to exclude those. But two
isn't illegal.

> I am sure someone has some complex regular expressions that they think 
> matches only potentially valid strings but, of course, as noted by 
> Chris, to really validate that an address works might require sending 
> something and validating a human replied and that can be quite  task.
>

Yes, many such regexes exist, and they are *all wrong*. Without exception. I
don't think it's actually possible for a regex to perfectly match all
(syntactically) valid email addresses and nothing else.

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

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


[issue42753] "./configure" linux chrome beta

2020-12-28 Thread Gerrik Labra


Gerrik Labra  added the comment:

Understood. Thank you.

On Mon, Dec 28, 2020 at 10:50 AM Eric V. Smith 
wrote:

>
> Eric V. Smith  added the comment:
>
> This appears to not be a bug with Python, so I'm going to close this. If
> you're having additional build problems, I suggest you ask for help on the
> python-list mailing list, or maybe on Stack Overflow.
>
> --
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
> type:  -> behavior
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



Re: Which method to check if string index is queal to character.

2020-12-28 Thread Chris Angelico
On Tue, Dec 29, 2020 at 10:08 AM Avi Gross via Python-list
 wrote:
>
> This may be a nit, but can we agree all valid email addresses as used today
> have more than an @ symbol?
>
> I see it as requiring at least one character before the @ that come from a
> list of allowed characters (perhaps not ASCII) but does not include the
> symbol @ again. It is normally followed by some minimal number of characters
> and maybe  a period and one of the currently valid domains like .com or .it
> but the latter gets tricky as it can look like u...@abd.def.att.com or other
> long variations where only the final component must be testable in the
> program.

There can be an @ in the first part of the address, and the domain may
well not have a dot.

> The lack of an at-sign suggests it is not an email address. The lack of
> anything before or after also seems to disqualify it. You may be able to add
> more conditions but as noted, having more than one at-sign may also
> disqualify it.

Lack of an at sign means it's a local address that can't be routed
over the internet, and in many contexts, it's reasonable to exclude
those. But two isn't illegal.

> I am sure someone has some complex regular expressions that they think
> matches only potentially valid strings but, of course, as noted by Chris, to
> really validate that an address works might require sending something and
> validating a human replied and that can be quite  task.
>

Yes, many such regexes exist, and they are *all wrong*. Without
exception. I don't think it's actually possible for a regex to
perfectly match all (syntactically) valid email addresses and nothing
else.

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


[issue42765] Introduce new data model method __iter_items__

2020-12-28 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue42774] 'ipaddress' module, bad result for 'is_private' on "192.0.0.0"

2020-12-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

The ipaddress documentation references 
https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml,
 which says that 192.0.0.0/29 is reserved and not globally reachable. I think 
in that sense, it's a private address.

--
nosy: +eric.smith

___
Python tracker 

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



[issue42774] 'ipaddress' module, bad result for 'is_private' on "192.0.0.0"

2020-12-28 Thread Trevor Marvin


New submission from Trevor Marvin :

Tested on Python 3.6.9 with "ipaddress" module, module version 1.0.

ipaddress.ip_address('192.0.0.0').is_private

Incorrectly returns as 'True'.  Per RFC 1918 / BCP 5, section 3, the private 
IPv4 space sarting with '192' is only '192.168.0.0/16'.

--
components: Library (Lib)
messages: 383942
nosy: trevormarvin
priority: normal
severity: normal
status: open
title: 'ipaddress' module, bad result for 'is_private' on "192.0.0.0"
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue42773] build.yml workflow not testing on pushes

2020-12-28 Thread Ammar Askar


Ammar Askar  added the comment:

Any commit that gets to pushed to the master, 3.9, 3.8 and 3.7 branches.

e.g all the commits here https://github.com/python/cpython/commits/master, they 
end up failing the "Check for source changes" step and skipping even when 
there's non-documentation changes.

--
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue40522] [subinterpreters] Get the current Python interpreter state from Thread Local Storage (autoTSSkey)

2020-12-28 Thread STINNER Victor


STINNER Victor  added the comment:

Mark Shannon experiment using __thread:

* 
https://mail.python.org/archives/list/python-...@python.org/thread/RPSTDB6AEMIACJFZKCKIRFTVLAJQLAS2/

* 
https://github.com/python/cpython/compare/master...markshannon:threadstate_in_tls

He added " extern __thread struct _ts *_Py_tls_tstate;" to 
Include/cpython/pystate.h.

--

___
Python tracker 

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



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread Zackery Spytz


Zackery Spytz  added the comment:

I've created a fix for this error.

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



[issue42772] randrange() mishandles step when stop is None

2020-12-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Should I restore that optimization in issue37319?

Yes, but to fix the bug it needs to occur earlier in the code (currently line 
314):

if stop is None and step is _ONE: <-- Line 314
   ^  <-- Add this   

And again later:
 if istep == 1 and width > 0:   <-- Line 348
 ^-- change to _ONE

As a standalone optimization, it wasn't worth it, but as a way to fix the bug 
without a regression, it is reasonable.

--

___
Python tracker 

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



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +22826
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23982

___
Python tracker 

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



[issue42773] build.yml workflow not testing on pushes

2020-12-28 Thread STINNER Victor


STINNER Victor  added the comment:

> build.yml workflow not testing on pushes

What does it mean: "on pushes"?

--

___
Python tracker 

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



[issue42754] Unpacking of literals inside other literals should be optimised away by the compiler

2020-12-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> This is a similar case. I am -1 for this optimization.

Yeah, I concur. One of the major drawbacks of this is that the normal case 
where this happens involves a Load():

z = "something"
x = ["a", *z, "b"]

I see almost no reason to nest the literals in this case, especially in a 
context sensitive scope. I am closing the draft PR and the issue.

Thanks Patrick for the proposal, though!

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

___
Python tracker 

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



RE: Which method to check if string index is queal to character.

2020-12-28 Thread Avi Gross via Python-list
This may be a nit, but can we agree all valid email addresses as used today
have more than an @ symbol?

I see it as requiring at least one character before the @ that come from a
list of allowed characters (perhaps not ASCII) but does not include the
symbol @ again. It is normally followed by some minimal number of characters
and maybe  a period and one of the currently valid domains like .com or .it
but the latter gets tricky as it can look like u...@abd.def.att.com or other
long variations where only the final component must be testable in the
program.

The lack of an at-sign suggests it is not an email address. The lack of
anything before or after also seems to disqualify it. You may be able to add
more conditions but as noted, having more than one at-sign may also
disqualify it.

I am sure someone has some complex regular expressions that they think
matches only potentially valid strings but, of course, as noted by Chris, to
really validate that an address works might require sending something and
validating a human replied and that can be quite  task.

-Original Message-
From: Python-list  On
Behalf Of Chris Angelico
Sent: Monday, December 28, 2020 2:24 PM
To: Python 
Subject: Re: Which method to check if string index is queal to character.

On Tue, Dec 29, 2020 at 6:18 AM Bischoop  wrote:
>
> On 2020-12-28, Stefan Ram  wrote:
> >
> >   "@" in s
> >
>
> That's what I thought.
>
> >>I want check if string is a valid email address.
> >
> >   I suggest to first try and define "valid email address" in English.
> >
> >
>
> A valid email address consists of an email prefix and an email domain, 
> both in acceptable formats. The prefix appears to the left of the @
symbol.
> The domain appears to the right of the @ symbol.
> For example, in the address exam...@mail.com, "example" is the email 
> prefix, and "mail.com" is the email domain.
>

To see if it's a valid email address, send email to it and get the person to
verify receipt. Beyond that, all you can really check is that it has an at
sign in it (since a local address isn't usually useful in contexts where
you'd want to check).

So the check you are already looking at is sufficient.

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

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


Re: Which method to check if string index is queal to character.

2020-12-28 Thread Michael Torrie
On 12/28/20 1:27 PM, Richard Damon wrote:
> Validating that it meets the SYNTAX of an email address isn't THAT hard,
> but there are a number of edge cases to worry about.

Yes one would think that, but in my experience half of all web sites get
it wrong, insisting that my perfectly valid and RFC-compliant email
address is not a proper email address.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Which method to check if string index is queal to character.

2020-12-28 Thread Grant Edwards
On 2020-12-28, Bischoop  wrote:
> On 2020-12-28, Stefan Ram  wrote:
>>
>>   "@" in s
>>
>
> That's what I thought.
>
>>>I want check if string is a valid email address.
>>
>>   I suggest to first try and define "valid email address" in English.
>
> A valid email address consists of an email prefix and an email domain,
> both in acceptable formats.

Well, that's assuming that bang routing/addresses aren't allowed. :)

--
Grant

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


Re: Which method to check if string index is queal to character.

2020-12-28 Thread Richard Damon
On 12/28/20 4:52 PM, Michael Torrie wrote:
> On 12/28/20 10:37 AM, Bischoop wrote:
>> A valid email address consists of an email prefix and an email domain,
>> both in acceptable formats. The prefix appears to the left of the @ symbol.
>> The domain appears to the right of the @ symbol.
>> For example, in the address exam...@mail.com, "example" is the email prefix,
>> and "mail.com" is the email domain.
> Seems so simple, yet at least half the web sites I try to use get it
> wrong.  There's an entire RFC on this topic.  Drives me crazy when a web
> site insists that myaddress+suf...@domain.com is not a valid address.
> It certainly is!

Yes, it really is fairly straight forward to do it right, but it does
have details that need to be checked carefully (It is significantly
harder if the email address can also contain comments or display names,
but just a base email address isn't that hard).

Many people do still get it wrong.

-- 
Richard Damon

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


[issue42393] Raise overflow errors iso. deprecation warnings in socket.htons and socket.ntohs (was deprecated in 3.7)

2020-12-28 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue35943] PyImport_GetModule() can return partially-initialized module

2020-12-28 Thread Cebtenzzre


Change by Cebtenzzre :


--
nosy: +cebtenzzre

___
Python tracker 

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



[issue41567] multiprocessing.Pool from concurrent threads failure on 3.9.0rc1

2020-12-28 Thread Cebtenzzre


Change by Cebtenzzre :


--
nosy: +cebtenzzre

___
Python tracker 

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



[issue42243] Don't access the module dictionary directly

2020-12-28 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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



[issue42243] Don't access the module dictionary directly

2020-12-28 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
resolution:  -> wont fix

___
Python tracker 

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



[issue42773] build.yml workflow not testing on pushes

2020-12-28 Thread Ammar Askar


New submission from Ammar Askar :

It looks like on pushes to Github, we currently aren't running tests. (Though 
this isn't too big of a concern since they get run on pull requests).

Here's an example of a recent run 
https://github.com/python/cpython/runs/1609911031

```
fatal: ambiguous argument 'origin/..': unknown revision or path not in the 
working tree.
Use '--' to separate paths from revisions, like this:
'git  [...] -- [...]'
```

--
components: Build
messages: 383935
nosy: FFY00, Mariatta, ammar2, vstinner
priority: normal
severity: normal
status: open
title: build.yml workflow not testing on pushes
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



Re: Which method to check if string index is queal to character.

2020-12-28 Thread Chris Angelico
On Tue, Dec 29, 2020 at 8:57 AM dn via Python-list
 wrote:
> After such disparagement it is worth remembering that there are checks
> and there are checks! It depends upon the purpose of the check, or the
> level-of-detail/accuracy desired!
>
> When accepting user-data it *is* worth (even "necessary") performing a
> 'sanity-check'. Per @Chris, if the user doesn't enter two 'words'
> separated by an @-sign, and the second 'word' doesn't include at least
> one dot/period/stop, then it seems quite probable that our user has made
> a typo! This is why some sites require an email address to be entered
> twice. (but copy-paste anyone?)

I wouldn't even ask for a dot in the second half, actually. Yes, it's
uncommon to have no dot, but it's fully legal, and not worth wrestling
with. Considering the vast number of typos that *wouldn't* trip a
filter, and the relatively small number that would, it's generally not
worth putting too much validation in.

Checking for the presence of "@" is a good way to check that it's an
email address and not, say, the URL of someone's webmail service, but
other than that, there's really not a lot that's worth checking.

OTOH, if you're trying to recognize email addresses in plain text
(say, in chat messages) so that you can autolink them, that's
completely different. Same with URLs (eg https://example.com/foo) -
you, as a human, can see that the URL should have ended at the "/foo",
but technically "/foo)" is perfectly legal. So if you're validating,
"/foo)" should be permitted, but if you're detecting, it should stop
at "/foo".

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


Re: Which method to check if string index is queal to character.

2020-12-28 Thread Cameron Simpson
On 28Dec2020 13:08, Mats Wichmann  wrote:
>On 12/28/20 10:46 AM, Marco Sulla wrote:
>>On Mon, 28 Dec 2020 at 17:37, Bischoop  wrote:
>>>I'd like to check if there's "@" in a string and wondering if any 
>>>method is better/safer than others.

Others have pointed out: '@' in s

>Will add that Yes, you should always validate your inputs, but No, the 
>presence of an @ sign in a text string is not sufficient to know it's a 
>valid email address. Unfortunately validating that is hard.

Validating that it is a functional email address is hard, involves 
delivering email and then finding out if it was delivered.

A proper syntax check requires parsing an RFC5322 address grammar:

https://tools.ietf.org/rfcmarkup/5322#section-3.4

Fortunately, Python ships with one of those in the email.utils module.

The parseaddr() function will parse a single address, and getaddresses() 
will parse a list of addresses such as might be in a To: header line.

They work well - I've been filing my email based on these for years - 
MANY thousands of messages.

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


Re: Which method to check if string index is queal to character.

2020-12-28 Thread dn via Python-list

On 29/12/2020 09:27, Richard Damon wrote:

On 12/28/20 3:08 PM, Mats Wichmann wrote:

On 12/28/20 10:46 AM, Marco Sulla wrote:

On Mon, 28 Dec 2020 at 17:37, Bischoop  wrote:

...


but probably what you really want is a regular expression.




because...



Will add that Yes, you should always validate your inputs, but No, the
presence of an @ sign in a text string is not sufficient to know it's
a valid email address. Unfortunately validating that is hard.




Validating that it meets the SYNTAX of an email address isn't THAT hard,
but there are a number of edge cases to worry about.

Validating that it is a working email address (presumably after
verifying that it has a proper syntax) is much harder, and basically
requires trying to send to the address, and to really confirm that it is
good requires them to do something actively with a message you send
them. And then nothing says the address will continue to be valid.



(am assuming the in/is question has been answered)


Looking at my email server log, I see messages addressed to 
"fd0d8f761...@danceswithmice.info" - which have been rejected.


That spurious-address features an "@". It is a perfectly-formed email 
address. The domain-name is correct - and can be quickly verified as 
in-existence.


However the account-name is a total fabrication. (is someone trying to 
put a 'hex' on me?)



Accordingly, the advice that the only way to check if an email address 
is 'correct', is to see if it is accepted by the receiving-server. 
However, you can't (shouldn't be able to!) pierce that veil, to be able 
to prove/see for yourself!


That is why many subscription-systems send an initial email message and 
ask the receiver to confirm receipt by 'clicking on the link provided'!



Per previous RegEx discussions 'here': there are plenty of 
examples/attempts floating around the Internet. Absolutely none of which 
comes with a guarantee!


To quote the famous con-man/men/women: if you believe any such stories, 
come and see me about buying into the Brooklyn Bridge/some agricultural 
(marsh) land/the next best thing...


For many years, many of the RegEx-s circulating were so precise that 
they only recognised the original TLDs such as .com and .org. For years 
after .info was introduced, sites would tell me that my email address 
was 'illegal'. Leaving me to ask: do I really exist?, am I but part of 
some imaginary universe? (no comments about my Hobbit-feet, please!)



After such disparagement it is worth remembering that there are checks 
and there are checks! It depends upon the purpose of the check, or the 
level-of-detail/accuracy desired!


When accepting user-data it *is* worth (even "necessary") performing a 
'sanity-check'. Per @Chris, if the user doesn't enter two 'words' 
separated by an @-sign, and the second 'word' doesn't include at least 
one dot/period/stop, then it seems quite probable that our user has made 
a typo! This is why some sites require an email address to be entered 
twice. (but copy-paste anyone?)



Going much further than a typo-reducing/sanity-check is, per @Richard, 
considerably harder - and ultimately cannot guarantee an address. Thus, 
indulges in a sub-field of cyber-alchemy!

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Which method to check if string index is queal to character.

2020-12-28 Thread Michael Torrie
On 12/28/20 10:46 AM, Marco Sulla wrote:
> On Mon, 28 Dec 2020 at 17:37, Bischoop  wrote:
>>
>> I'd like to check if there's "@" in a string and wondering if any method
>> is better/safer than others. I was told on one occasion that I should
>> use is than ==, so how would be on this example.
>>
>> s = 't...@mail.is'
> 
> You could do simply
> 
> if "@" in s:
> 
> but probably what you really want is a regular expression.

https://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx/

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


Re: Which method to check if string index is queal to character.

2020-12-28 Thread Michael Torrie
On 12/28/20 10:37 AM, Bischoop wrote:
> A valid email address consists of an email prefix and an email domain,
> both in acceptable formats. The prefix appears to the left of the @ symbol.
> The domain appears to the right of the @ symbol.
> For example, in the address exam...@mail.com, "example" is the email prefix,
> and "mail.com" is the email domain.

Seems so simple, yet at least half the web sites I try to use get it
wrong.  There's an entire RFC on this topic.  Drives me crazy when a web
site insists that myaddress+suf...@domain.com is not a valid address.
It certainly is!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42754] Unpacking of literals inside other literals should be optimised away by the compiler

2020-12-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not think there are serious raesons for adding this optimization. The 
Python compiler was intentionally made simple for maintainability. Constant 
folding supports only base arithmetic and bits operations because they are 
often used in constant expressions (like 2**32-1 or 1<<18) and indexing because 
of b'A'[0]. Neither comparisons, nor boolean operators with constants are 
optimized, because such expression are uncommon, and the maintaining cost 
overdraws benefit.

This is a similar case. I am -1 for this optimization.

--

___
Python tracker 

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



[issue42765] Introduce new data model method __iter_items__

2020-12-28 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Hi Richard,


> Also, using _asdict() seems strange as an exposed API, since it's an 
> underscore method and users hence might not be inclined to use it.

I don't consider this a strong argument. Named tuple in general has to use a 
naming convention for public methods that cannot clash with field names, hence 
the single underscore, but your concrete named tuple class can offer any 
methods you like since you know which field names are used and which are not. 
Just add a public method "asdict" or any name you prefer, and delegate to the 
single underscore method.



> It would be nicer to have my type just return this appropriate dict when 
> invoking dict(BasicStats(…)).

As we speak there is a discussion on Python-Ideas about this.

https://mail.python.org/archives/list/python-id...@python.org/thread/2HMRGJ672NDZJZ5PVLMNVW6KP7OHMQDI/#UYDIPMY2HXGL4OLEEFXBTZ2T4CK6TSVU

Your input would be appreciated.


> This would require me to override the __iter__() method to yield key / value 
> tuples for the dict.

The dict constructor does not require that. See discussion on the thread above.

If you search the Python-Ideas archives, I am sure you will find past proposals 
for a `__json__` protocol. If I recall correctly, there was some concern about 
opening the flood-gates for dunder protocols (will this be followed with 
demands for __yaml__, __xml__, __cson__, __toml__, etc?) but perhaps the time 
is right to revisit this idea.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue42754] Unpacking of literals inside other literals should be optimised away by the compiler

2020-12-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I have added a draft PR on how the idea would look like so we can discuss with 
a specific proposal.

--

___
Python tracker 

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



[issue42754] Unpacking of literals inside other literals should be optimised away by the compiler

2020-12-28 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue42772] randrange() mishandles step when stop is None

2020-12-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> Another solution is to use an identity test for the step argument

Should I restore that optimization in issue37319?

--

___
Python tracker 

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



[issue42772] randrange() mishandles step when stop is None

2020-12-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Another solution is to use an identity test for the step argument

_one = 1

class Random:
def randrange(start, stop=None, step=_one):
...
if stop is None and step is _one:
if istart > 0:
return self._randbelow(istart)

This has the advantage of keeping the API unchanged while still keeping the 
fast path fast.

--

___
Python tracker 

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



[issue42739] Crash when try to disassemble bogus code object

2020-12-28 Thread Ammar Askar


Ammar Askar  added the comment:

This seems to be part 2 of the problems Mark mentioned in issue42562. Namely in 
this case the `co_lnotab` accessor uses PyLineTable_NextAddressRange which has 
that assertion.

--
nosy: +ammar2

___
Python tracker 

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



[issue42772] randrange() mishandles step when stop is None

2020-12-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Note, we can't actually use "self.choice(range(*args))" because the underlying 
len() call can Overflow.  If it does, the components need to be computed 
manually.

--

___
Python tracker 

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



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread Ammar Askar


Ammar Askar  added the comment:

Confirmed, the attribute under 
https://docs.python.org/3.10/library/email.headerregistry.html#email.headerregistry.ContentDispositionHeader
 is incorrect.

bazwal, would you like to propose a patch to fix this? The code is here: 
https://github.com/python/cpython/blob/master/Doc/library/email.headerregistry.rst

--
nosy: +ammar2

___
Python tracker 

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



[issue42771] Implement interactive hotkey, Ctrl+L to clear the console in Windows.

2020-12-28 Thread Eryk Sun


Eryk Sun  added the comment:

> As the legacy cmd.exe can be easily replaced, that leaves python.exe. 

python.exe is a console application, which attaches to a console session. Since 
Windows 7, each console session is hosted by an instance of conhost.exe.

The CMD shell (cmd.exe) is a console application, the same as python.exe. It 
doesn't matter whether Python allocates a new console or inherits it from 
another process such as cmd.exe.

> Likely needs to be configured via readline or its analog used under 
> Windows.

pyreadline implements readline for the Windows console API via ctypes. It 
supports Ctrl+L to clear the screen, including the scrollback. PSReadLine in 
PowerShell implements Ctrl+L without clearing the scrollback. That's a better 
example to follow if someone wants to take up the ambitious project of 
supporting readline for Windows in the standard library.

--
nosy: +eryksun

___
Python tracker 

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



Re: Which method to check if string index is queal to character.

2020-12-28 Thread Richard Damon
On 12/28/20 3:08 PM, Mats Wichmann wrote:
> On 12/28/20 10:46 AM, Marco Sulla wrote:
>> On Mon, 28 Dec 2020 at 17:37, Bischoop  wrote:
>>>
>>> I'd like to check if there's "@" in a string and wondering if any
>>> method
>>> is better/safer than others. I was told on one occasion that I should
>>> use is than ==, so how would be on this example.
>>>
>>> s = 't...@mail.is'
>>
>> You could do simply
>>
>> if "@" in s:
>>
>> but probably what you really want is a regular expression.
>>
>
> Will add that Yes, you should always validate your inputs, but No, the
> presence of an @ sign in a text string is not sufficient to know it's
> a valid email address. Unfortunately validating that is hard.
>
Validating that it meets the SYNTAX of an email address isn't THAT hard,
but there are a number of edge cases to worry about.

Validating that it is a working email address (presumably after
verifying that it has a proper syntax) is much harder, and basically
requires trying to send to the address, and to really confirm that it is
good requires them to do something actively with a message you send
them. And then nothing says the address will continue to be valid.

-- 
Richard Damon

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


[issue42740] typing.py get_args and get_origin should support PEP 604 and 612

2020-12-28 Thread miss-islington


miss-islington  added the comment:


New changeset 03e571f1d5f3e7a11f33bb9f47dd4acedf17b166 by Miss Islington (bot) 
in branch '3.9':
bpo-42740: Fix get_args for PEP 585 collections.abc.Callable (GH-23963)
https://github.com/python/cpython/commit/03e571f1d5f3e7a11f33bb9f47dd4acedf17b166


--

___
Python tracker 

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



[issue42048] Document Argument Clinic's defining_class converter

2020-12-28 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



Re: Which method to check if string index is queal to character.

2020-12-28 Thread Mats Wichmann

On 12/28/20 10:46 AM, Marco Sulla wrote:

On Mon, 28 Dec 2020 at 17:37, Bischoop  wrote:


I'd like to check if there's "@" in a string and wondering if any method
is better/safer than others. I was told on one occasion that I should
use is than ==, so how would be on this example.

s = 't...@mail.is'


You could do simply

if "@" in s:

but probably what you really want is a regular expression.



Will add that Yes, you should always validate your inputs, but No, the 
presence of an @ sign in a text string is not sufficient to know it's a 
valid email address. Unfortunately validating that is hard.


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


[issue42740] typing.py get_args and get_origin should support PEP 604 and 612

2020-12-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22822
pull_request: https://github.com/python/cpython/pull/23977

___
Python tracker 

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



[issue42740] typing.py get_args and get_origin should support PEP 604 and 612

2020-12-28 Thread miss-islington


miss-islington  added the comment:


New changeset 4140f10a16f06c32fd49f9e21fb2a53abe7357f0 by Ken Jin in branch 
'master':
bpo-42740: Fix get_args for PEP 585 collections.abc.Callable (GH-23963)
https://github.com/python/cpython/commit/4140f10a16f06c32fd49f9e21fb2a53abe7357f0


--
nosy: +miss-islington

___
Python tracker 

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



[issue42767] Review usage of atomic variables in signamodule.c

2020-12-28 Thread Ammar Askar


Ammar Askar  added the comment:

> For me, the most surprising part is Handlers[signum].tripped which is 
> declared as volatile *and* an atomic variable.

I think it's just following this part of the C spec (Some background in 
bpo-12060):

> or refers to any object with static storage duration other than by assigning 
> a value to a static storage duration variable of type volatile sig_atomic_t. 
> Furthermore, if such a call fails, the value of errno is unspecified.

https://pubs.opengroup.org/onlinepubs/007904875/functions/sigaction.html / 
https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers

> I'm not sure if Handlers[signum].func must be volatile neither.

I think your assessment here is right considering it's never used in the signal 
handler itself.

> Also, wakeup.fd is declared as sig_atomic_t on Unix. Could we use an atomic 
> variable instead, or is it important to use "sig_atomic_t"?

Again looking at the 
https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers
 recommendation it seems like using an atomic variable is fine but only if it's 
lock-free.

--
nosy: +ammar2

___
Python tracker 

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



[issue42772] randrange() mishandles step when stop is None

2020-12-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +tim.peters

___
Python tracker 

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



[issue42772] randrange() mishandles step when stop is None

2020-12-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

One fix is to move up the code for converting step to istep and then modify the 
early out test to:  

if stop is None and istep == 1:
if istart > 0:
return self._randbelow(istart)

That would have the downside of slowing down the common case.

Another possibility is changing the default step to a sentinel object and just 
testing for that:

if stop is None and step is sentinel:
if istart > 0:
return self._randbelow(istart)

That would be user visible in the function signature but it would run fast.

We could bite the bullet and fully harmonize the randrange() signature with 
range().  That would entail switching to *args and no longer accepting keyword 
arguments:

 def randrange(self, /, *args):
 "Choose random item from range(stop) or range(start, stop[, step])."
 return self.choice(range(*args))

This would most closely match user expectations but is potentially a breaking 
change for existing code that uses keyword arguments.  Such code probably 
exists but is probably not common.

For speed, the actual implementation could still have fast paths for common 
cases.

For help() and tooltips, we could add a __text_signature__ to cover-up the 
*args.  However, signature objects currently aren't capable of describing 
range().  The best we could do is:

randrange.__text_signature__ = '($self, start, stop, step, /)'

That would give help() that looks like this:

>>> help(randrange)
Help on method randrange in module Random:

randrange(start, stop, step, /) method of __main__.R instance
Choose random item from range(stop) or range(start, stop[, step]).

--

___
Python tracker 

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



[issue42762] infinite loop resulted by "yield"

2020-12-28 Thread Steve Stagg


Steve Stagg  added the comment:

Behaviour was changed in this commit:
---
commit ae3087c6382011c47db82fea4d05f8bbf514265d
Author: Mark Shannon 
Date:   Sun Oct 22 22:41:51 2017 +0100

Move exc state to generator. Fixes bpo-25612 (#1773)

Move exception state information from frame objects to coroutine 
(generator/thread) object where it belongs.

---

I'm honestly not sure that the older behaviour was 'better' than current.  But 
I don't know the defined behaviours well enough to be certain

--
nosy: +stestagg

___
Python tracker 

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



[issue42771] Implement interactive hotkey, Ctrl+L to clear the console in Windows.

2020-12-28 Thread Mike Miller


Mike Miller  added the comment:

I found an implementation of this for Windows in case it is needed.  Not sure 
if it is the best way to do it, as the Console API is rather clumsy.  However 
this one works to my knowledge:

https://github.com/tartley/colorama/blob/master/colorama/winterm.py#L111

--

___
Python tracker 

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



[issue42772] randrange() mishandles step when stop is None

2020-12-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



Re: Which method to check if string index is queal to character.

2020-12-28 Thread Chris Angelico
On Tue, Dec 29, 2020 at 6:18 AM Bischoop  wrote:
>
> On 2020-12-28, Stefan Ram  wrote:
> >
> >   "@" in s
> >
>
> That's what I thought.
>
> >>I want check if string is a valid email address.
> >
> >   I suggest to first try and define "valid email address" in English.
> >
> >
>
> A valid email address consists of an email prefix and an email domain,
> both in acceptable formats. The prefix appears to the left of the @ symbol.
> The domain appears to the right of the @ symbol.
> For example, in the address exam...@mail.com, "example" is the email prefix,
> and "mail.com" is the email domain.
>

To see if it's a valid email address, send email to it and get the
person to verify receipt. Beyond that, all you can really check is
that it has an at sign in it (since a local address isn't usually
useful in contexts where you'd want to check).

So the check you are already looking at is sufficient.

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


[issue42772] randrange() mishandles step when stop is None

2020-12-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



Re: Which method to check if string index is queal to character.

2020-12-28 Thread Terry Reedy

On 12/28/2020 11:31 AM, Bischoop wrote:

I'd like to check if there's "@" in a string


Use the obvious "'@' in string".
 > and wondering if any method is better/safer than others.

Any special purpose method built into the language is likely to be 
fastest.  Safest?  What danger are you worried about?



I was told on one occasion that I should
use is than ==, so how would be on this example.


'is' is for detecting an exact match with a particular, singular object. 
 In particular, None, False, or True or user created objects meant for 
such use.



s = 't...@mail.is'



I want check if string is a valid email address.


There are two levels of validity: has the form of an address, which is 
much more complicated than the presence of an '@', and corresponds to a 
real email account.




code '''
import time

email = "t...@mail.tu"

start_time = time.time()
for i in range(len(email)):
   print('@' in email[i])


This scans the entire string in a slow way, then indirectly performs '@' 
== char in a slow way.



print ("My program took", time.time() - start_time, "to run")


print('--')
start_time = time.time()
for i in range(len(email)):
 print(email[i] == '@')


Slightly better, does comparison directly.

for c in email:
   print(c == '@')

Faster and better way to scan.

for c in email:
   print(c == '@')
   break

Stops at first '@'.  '@' in email does the same, but should be slightly 
faster as it implements loop and break in the interpreter's 
implementation language.



print ("My program took", time.time() - start_time, "to run")
print('--')
start_time = time.time()
if '@' in email:
 print('True')

print ("My program took", time.time() - start_time, "to run")

'''




--
Terry Jan Reedy

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


[issue42772] randrange() mishandles step when stop is None

2020-12-28 Thread Raymond Hettinger


New submission from Raymond Hettinger :

When stop is None, the step argument is ignored:

>>> randrange(1000, None, 100)
651
>>> randrange(1000, step=100)
673

--
components: Library (Lib)
messages: 383919
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: randrange() mishandles step when stop is None
type: behavior
versions: Python 3.10

___
Python tracker 

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



Re: Which method to check if string index is queal to character.

2020-12-28 Thread Bischoop
On 2020-12-28, Stefan Ram  wrote:
>
>   "@" in s
>

That's what I thought.

>>I want check if string is a valid email address.
>
>   I suggest to first try and define "valid email address" in English.
>
>

A valid email address consists of an email prefix and an email domain,
both in acceptable formats. The prefix appears to the left of the @ symbol.
The domain appears to the right of the @ symbol.
For example, in the address exam...@mail.com, "example" is the email prefix,
and "mail.com" is the email domain.

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


[issue37319] Deprecate using random.randrange() with non-integers

2020-12-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I merged in PR 23064. If you want to make further modifications or improvements 
that would be welcome.

--

___
Python tracker 

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



[issue42771] Implement interactive hotkey, Ctrl+L to clear the console in Windows.

2020-12-28 Thread Mike Miller


New submission from Mike Miller :

The Ctrl+L as clear-screen hotkey is supported just about everywhere, Unix and 
Windows, with the exceptions of cmd.exe and python.exe interactive mode.

As the legacy cmd.exe can be easily replaced, that leaves python.exe.  Likely 
needs to be configured via readline or its analog used under Windows.

Documenting it would be good too.  Am happy to help, write, or test.

--
components: Windows
messages: 383917
nosy: mixmastamyk, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Implement interactive hotkey, Ctrl+L to clear the console in Windows.
type: enhancement

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-12-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue42222] Modernize integer test/conversion in randrange()

2020-12-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset a9621bb301dba44494e81edc00e3a3b62c96af26 by Raymond Hettinger in 
branch 'master':
bpo-4: Modernize integer test/conversion in randrange() (#23064)
https://github.com/python/cpython/commit/a9621bb301dba44494e81edc00e3a3b62c96af26


--

___
Python tracker 

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



[issue42763] Exposing a race in the "_warnings" resulting Python parser crash

2020-12-28 Thread Steve Stagg


Steve Stagg  added the comment:

Looks like a duplicate of issue42717.  

Causing a daemonic thread to terminate while doing IO will trigger the above 
abort

--
nosy: +stestagg

___
Python tracker 

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



[issue42753] "./configure" linux chrome beta

2020-12-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

This appears to not be a bug with Python, so I'm going to close this. If you're 
having additional build problems, I suggest you ask for help on the python-list 
mailing list, or maybe on Stack Overflow.

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

___
Python tracker 

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



[issue42717] The python interpreter crashed with "_enter_buffered_busy"

2020-12-28 Thread Steve Stagg


Steve Stagg  added the comment:

I think the problem here is that the issue can only really be detected late on 
during interpreter shutdown.

This makes recovery very hard to do.  Plus the thread termination has left 
shared state in an unmanaged condition, so it's super dangerous to re-enter 
python again

--

___
Python tracker 

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



[issue42754] Unpacking of literals inside other literals should be optimised away by the compiler

2020-12-28 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

We could possibly fold this at the AST optimizer, though I am not sure whether 
this worths anything as an optimization since it is a real obscure pattern. 
I've only found 2 occurrences (both from the test suite of black) on a 
relatively ~big dataset of python source code.

--

___
Python tracker 

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



Re: Which method to check if string index is queal to character.

2020-12-28 Thread MRAB

On 2020-12-28 16:31, Bischoop wrote:

I'd like to check if there's "@" in a string and wondering if any method
is better/safer than others. I was told on one occasion that I should
use is than ==, so how would be on this example.


[snip]

The shortest and quickest way to check whether "@" is in my_string is:

"@" in my_string
--
https://mail.python.org/mailman/listinfo/python-list


  1   2   >