[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-14 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +23319
pull_request: https://github.com/python/cpython/pull/24532

___
Python tracker 

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



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-14 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +23318
pull_request: https://github.com/python/cpython/pull/24531

___
Python tracker 

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



Efficiency debates

2021-02-14 Thread Avi Gross via Python-list
I think we have discussed this a few times. There are tradeoffs in computer 
science and obviously a compiled language with some optimization using 
low-level data structures does much better at solving simple problems.

Interpreted languages often have serious overhead to start with and allow all 
kinds of flexibility  that comes with more costs such as functions that handle 
arbitrary types of arguments.

When languages keep adding not only features but accommodate many programming 
styles such as object-oriented and functional or multiple ways to do the same 
thing, there is often more bloat. In python, there are almost always many ways 
to do anything!

So, I find it easier to develop in such languages BUT if the program is to be 
run regularly and uses lots of resources and especially if it does not need 
many of the dynamic features, there are ways to try to tune it within Python or 
use a faster attached library of functions in languages like C for some parts 
or leaving Python entirely. If a program does not actually need much of what 
Python offers, fine. Use something else. I know in another language called R, 
that more and more parts are rewritten in a dialect of C/C++ so some things run 
quite fast if they call such functions. Users learn to use vectorized methods 
instead of loops to gain speed.

I have recently seen discussions that some tried to solve using nontrivial 
regular expressions when simpler and faster methods using normal string 
functions would do. Unless that application also needed much more, it could 
easily be done in C or C++ or if needed in a very localized assembler. 

Python may be closer to one-size fits all but sometimes more than is needed. 

But it is not the only example of where people choose a sledge-hammer when a 
thumbtack will do. But as humans, we may do better working in ways that work 
well with our normal thinking process or one we can learn and feels natural. 
Every language I know has problems that look easy to solve using features in it 
and others that are painful to contemplate. Lately, I have done work combining 
Python parts with R parts to use the powerful features I already know how to 
use well in each. The new R STUDIO supports Python and quite a few other 
languages now as well as notebooks and document preparation and more. But I 
make no claim it is fast. It is very convenient and sometimes that is worth 
more especially for a one-off project.

Those who want speed, go for it. If you can find libraries of functions or 
class prototypes that are just what you need, great. But if a language like 
Python has even more resources available in lots of modules or packages as well 
as more flexible data types, then maybe a hundred lines of that will be easier 
to write than thousands of lines elsewhere. How convenient is it to work with 
data.frame type objects in C/C++ as compared to using numpy and pandas?

For many of us, we work with machines with ever more power and most of the time 
it just sits there idling. Now if you have something on servers that is running 
many simultaneous copies all the time to process complex requests from users, 
then efficiency should matter. If you pay for it or worry about how much 
electricity it uses, fine.

This forum does not care if you prefer C/C++ and is meant to discuss Python for 
people interested in Python. Repeated attacks make people ignore the person and 
not take anything they say as meaningful. I tried sharing my understanding of a 
recent proposal and remain unconvinced it is trivial and certainly doubt that 
it is doable as it is too grandiose and suggests any imaginable computer 
language will trivially be handled. I am sure it would have fun dealing with a 
programming  language in Hebrew with most text going from right to left but 
numbers the other way, and with added features built-in that nobody is using 
yet. Oh, I have no intention of doing so, but I suggest a more doable goal 
would be to be able to handle five procedural languages with no objects or 
functional programming before making bold claims. If that works, expand.

A more efficient use of my time is to tell my mailer which messages to toss. 


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


[issue43227] Backslashes in function arguments in f-string expressions

2021-02-14 Thread Eric V. Smith


Change by Eric V. Smith :


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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Dustin Rodrigues


Change by Dustin Rodrigues :


--
pull_requests: +23317
pull_request: https://github.com/python/cpython/pull/24530

___
Python tracker 

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



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-14 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +23316
pull_request: https://github.com/python/cpython/pull/24529

___
Python tracker 

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



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-14 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +23315
pull_request: https://github.com/python/cpython/pull/24528

___
Python tracker 

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



[issue43227] Backslashes in function arguments in f-string expressions

2021-02-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

Yes, they're prohibited anywhere inside of the braces {}.

This might be relaxed in the future, but through 3.9 it's still enforced.

--

___
Python tracker 

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



[issue43227] Backslashes in function arguments in f-string expressions

2021-02-14 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eric.smith

___
Python tracker 

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



[issue43227] Backslashes in function arguments in f-string expressions

2021-02-14 Thread Thomas Nabelek


New submission from Thomas Nabelek :

>From https://www.python.org/dev/peps/pep-0498/#escape-sequences:
"Backslashes may not appear inside the expression portions of f-strings"

Is this supposed to be true even for arguments to functions inside of the 
expression?

my_str = "test\ test\ test"
path = f"{my_str.replace(r'\ ', ' ')}"

gives

my_str = "test\ test\ test"
path = f"{my_str.replace(r'\ ', ' ')}"

SyntaxError: f-string expression part cannot include a backslash

--
messages: 386978
nosy: nabelekt
priority: normal
severity: normal
status: open
title: Backslashes in function arguments in f-string expressions
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



Re: New Python implementation

2021-02-14 Thread Dan Stromberg
On Sun, Feb 14, 2021 at 3:05 PM Christian Gollwitzer 
wrote:

> Am 14.02.21 um 11:12 schrieb Paul Rubin:
> > Christian Gollwitzer  writes:
> >> He wants that neoGFX is scriptable in Python, but instead of linking
> >> with CPython, he will write his own Python implementation instead,
> >> because CPython is slow/not clean/ whatever. He doesn't seem to
> >> understand that this is an enormous task on its own, because the
> >> interesting part of a scripting language is the standard library with
> >> many decade-years of work.
> >
> > I wonder how big an issue the stdlib really is.  Lots of it is written
> > in Python and can port to another interpreter.  Lots more is CPython C
> > API bindings to external C libraries (e.g. OpenSSL) so porting those
> > would be a matter of rebinding those libraries to libffi in the cases
> > where that hasn't been done already.
>
Hopefully CFFI, not libffi:  https://cffi.readthedocs.io/en/latest/

I'm not saying that it is unfeasible or very difficult. I'm saying that
> it is a lot of work


It is.

However, IronPython and Shedskin do not have a full Python standard
library.  I'd still call them "Python".
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43182] TURTLE: Default values for basic Turtle commands

2021-02-14 Thread Bruce Fuda


Bruce Fuda  added the comment:

Added turtle experts to nosy list

--
nosy: +gregorlingl, willingc

___
Python tracker 

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



Re: New Python implementation

2021-02-14 Thread Mr Flibble

On 14/02/2021 23:00, Christian Gollwitzer wrote:

Am 14.02.21 um 11:12 schrieb Paul Rubin:

Christian Gollwitzer  writes:

He wants that neoGFX is scriptable in Python, but instead of linking
with CPython, he will write his own Python implementation instead,
because CPython is slow/not clean/ whatever. He doesn't seem to
understand that this is an enormous task on its own, because the
interesting part of a scripting language is the standard library with
many decade-years of work.


I wonder how big an issue the stdlib really is.  Lots of it is written
in Python and can port to another interpreter.  Lots more is CPython C
API bindings to external C libraries (e.g. OpenSSL) so porting those
would be a matter of rebinding those libraries to libffi in the cases
where that hasn't been done already.


I'm not saying that it is unfeasible or very difficult. I'm saying that it is a lot of work, and for a single 
developer who has this as a side project / support for his graphics engine and who wants to beat existing 
implementations wrt. speed, I'm saying it is going to take a lot of time. It'definitely impossible by 
"defining a few JSON schema files", as Leigh claims with his "universal compiler". There 
definitely IS a lot of stuff in a baseline CPython interpreter - a (seemingly) simple thing like 
"print" will have an implementation of 1000 lines in C with all the formatting library, file I/O 
etc. Arbitrary precision integers - another library, networking - yet another and so on.


There will only be one schema file and it is will be a relatively small task which certainly isn't 
"impossible": I should have a working implementation by the summer.  As far as arbitrary 
precision integers are concerned I am well on the way to completing the "neonumeral" 
library (which also has arbitrary precision floats).

As far as the standard library is concerned: that is already in Python so I 
should be able to support it with little effort; the only thing requiring more 
work would be the built-ins.




CPython really is pretty slow, maybe because it uses so much boxed data,
derps around with refcounts all the time, suffers memory fragmentation
from not having a relocating GC, etc.  And that is before we even
mention the GIL.


I don't argue with that. CPython is slow. But I'm arguing that you can't make 
it faster by multiple orders of magnitude unless you change the language. For 
numerical code, straight-forward C is usually 100x to 1000x faster than Python, 
and you can reach the same performance by giving up dynamic typing - Cython 
demonstrates this quite convincingly. If you don't want static typing (with 
types close to the machine like fixed-width integers) than you'll have to 
resort to a LOT of black magic to even come close (PyPy, modern JS engines, 
)


I believe PyPy is only 4x faster than CPython on average and comes nowhere near 
close to JS JIT engines performance-wise.

/Flibble

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


[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> works for me
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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Neel Gore


Neel Gore  added the comment:

Ah in hindsight I see why this was troublesome; the directory name was "Project 
4/5", and zsh was displaying the / with a :. Renaming the directory to "Project 
4_5" fixed the problem. Thanks everyone!

--

___
Python tracker 

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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Dustin Rodrigues


Dustin Rodrigues  added the comment:

FWIW, it looks like spaces in directory names in macOS seem to be handled okay 
in both bash and zsh when working with venv's activate script. Colons do not 
and there doesn't appear to be a workaround other than not working in a 
directory with a colon in its name when you want to include that directory in 
your PATH.

--

___
Python tracker 

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



Re: New Python implementation

2021-02-14 Thread Christian Gollwitzer

Am 14.02.21 um 11:12 schrieb Paul Rubin:

Christian Gollwitzer  writes:

He wants that neoGFX is scriptable in Python, but instead of linking
with CPython, he will write his own Python implementation instead,
because CPython is slow/not clean/ whatever. He doesn't seem to
understand that this is an enormous task on its own, because the
interesting part of a scripting language is the standard library with
many decade-years of work.


I wonder how big an issue the stdlib really is.  Lots of it is written
in Python and can port to another interpreter.  Lots more is CPython C
API bindings to external C libraries (e.g. OpenSSL) so porting those
would be a matter of rebinding those libraries to libffi in the cases
where that hasn't been done already.


I'm not saying that it is unfeasible or very difficult. I'm saying that 
it is a lot of work, and for a single developer who has this as a side 
project / support for his graphics engine and who wants to beat existing 
implementations wrt. speed, I'm saying it is going to take a lot of 
time. It'definitely impossible by "defining a few JSON schema files", as 
Leigh claims with his "universal compiler". There definitely IS a lot of 
stuff in a baseline CPython interpreter - a (seemingly) simple thing 
like "print" will have an implementation of 1000 lines in C with all the 
formatting library, file I/O etc. Arbitrary precision integers - another 
library, networking - yet another and so on.



CPython really is pretty slow, maybe because it uses so much boxed data,
derps around with refcounts all the time, suffers memory fragmentation
from not having a relocating GC, etc.  And that is before we even
mention the GIL.


I don't argue with that. CPython is slow. But I'm arguing that you can't 
make it faster by multiple orders of magnitude unless you change the 
language. For numerical code, straight-forward C is usually 100x to 
1000x faster than Python, and you can reach the same performance by 
giving up dynamic typing - Cython demonstrates this quite convincingly. 
If you don't want static typing (with types close to the machine like 
fixed-width integers) than you'll have to resort to a LOT of black magic 
to even come close (PyPy, modern JS engines, )


Christian

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


[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Dustin Rodrigues


Dustin Rodrigues  added the comment:

What's the name of the current directory? Does it end with "Project 4:5"? It 
may be the colon in the directory name is interfering with the PATH parsing so 
that the shell thinks that the first two entries in your path after the venv 
activate are

/Users/neelgore/Documents/UC Irvine/Y1/Q2/ICS 32/Project 4
5/.venv/bin

instead of

"/Users/neelgore/Documents/UC Irvine/Y1/Q2/ICS 32/Project 4:5/.venv/bin"

being the first entry.

--

___
Python tracker 

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



Re: Change first occurrence of character x in a string - how?

2021-02-14 Thread Mr Flibble

On 14/02/2021 21:14, Chris Green wrote:

What's the easiest way to change the first occurrence of a specified
character in a string?


By using a grown up (i.e. non-toy) programming language.

/Flibble

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


[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Eric V. Smith

Eric V. Smith  added the comment:

Thanks. I’m guessing the space in the path is causing a problem.

--

___
Python tracker 

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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Neel Gore


Neel Gore  added the comment:

This is Python 3.9.1 from the normal python.org download.

Before venv activation, "echo $PATH" gives:

/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware
 Fusion.app/Contents/Public

After activation, "ls -l .venv/bin" gives:

total 88
-rw-rw-r--  1 neelgore  staff  8834 Feb 14 14:51 Activate.ps1
-rw-rw-r--  1 neelgore  staff  1942 Feb 14 14:51 activate
-rw-rw-r--  1 neelgore  staff   891 Feb 14 14:51 activate.csh
-rw-rw-r--  1 neelgore  staff  2031 Feb 14 14:51 activate.fish
-rwxr-xr-x  1 neelgore  staff   327 Feb 14 14:51 easy_install
-rwxr-xr-x  1 neelgore  staff   327 Feb 14 14:51 easy_install-3.9
-rwxr-xr-x  1 neelgore  staff   318 Feb 14 14:51 pip
-rwxr-xr-x  1 neelgore  staff   318 Feb 14 14:51 pip3
-rwxr-xr-x  1 neelgore  staff   318 Feb 14 14:51 pip3.9
lrwxr-xr-x  1 neelgore  staff 7 Feb 14 14:51 python -> python3
lrwxr-xr-x  1 neelgore  staff61 Feb 14 14:51 python3 -> 
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
lrwxr-xr-x  1 neelgore  staff 7 Feb 14 14:51 python3.9 -> python3

and "echo $PATH" gives:

/Users/neelgore/Documents/UC Irvine/Y1/Q2/ICS 32/Project 
4:5/.venv/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware
 Fusion.app/Contents/Public

--

___
Python tracker 

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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Ned Deily


Ned Deily  added the comment:

It could be that the activate is failing for some reason in that directory or 
terminal session.  Try it in a new terminal session after entering "set -x" so 
you can see the expanded commands.

--

___
Python tracker 

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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

Where did you install Python from?

Before you've activated the virtual env, please run "echo $PATH".

After you've activated the virtual env, can you run "ls -l .venv/bin" and "echo 
$PATH"?

--

___
Python tracker 

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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Neel Gore


Neel Gore  added the comment:

(sorry for double message)
update:

Just created a venv in Desktop and another in a directory in Documents and got 
the correct behavior both times. Seems like the issue is isolated to the 
certain directory?

--

___
Python tracker 

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



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-14 Thread Senthil Kumaran


Senthil Kumaran  added the comment:


New changeset fcbe0cb04d35189401c0c880ebfb4311e952d776 by Adam Goldschmidt in 
branch 'master':
bpo-42967: only use '&' as a query string separator (#24297)
https://github.com/python/cpython/commit/fcbe0cb04d35189401c0c880ebfb4311e952d776


--

___
Python tracker 

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



[issue43226] build from 3.9.1 tarball on WSL failed

2021-02-14 Thread DoctorDan


New submission from DoctorDan :

Attempted to build 3.9.1 on WSL from tarball Python-3.9.1.tar.xz
Make - succeeded
Make test - Many tests failed
Make install - failed

Attaching the tail end of the console trace. The scrollback buffer was not big 
enough to accomodate the whole thing. If there is a log file I don't know where 
it is.

--
components: Build
files: tail of make test log.txt
messages: 386967
nosy: DoctorDan
priority: normal
severity: normal
status: open
title: build from 3.9.1 tarball on WSL failed
type: compile error
versions: Python 3.9
Added file: https://bugs.python.org/file49809/tail of make test log.txt

___
Python tracker 

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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Neel Gore


Neel Gore  added the comment:

Just ran:

neelgore@Neels-MacBook-Pro Project 4:5 % rm -r .venv
neelgore@Neels-MacBook-Pro Project 4:5 % which python3  
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
neelgore@Neels-MacBook-Pro Project 4:5 % python3 -m venv .venv
neelgore@Neels-MacBook-Pro Project 4:5 % source .venv/bin/activate
(.venv) neelgore@Neels-MacBook-Pro Project 4:5 % which python3
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
(.venv) neelgore@Neels-MacBook-Pro Project 4:5 %

--

___
Python tracker 

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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Ned Deily


Ned Deily  added the comment:

Are you sure there wasn't an existing virtual environment at .venv? By default, 
venv does not upgrade an existing environment. Try deleting the .venv directory 
first, assuming there is nothing in the environment you want to save. Otherwise 
you could try debugging the shell steps with the shell command:

set -x

and, if necessary, debugging the python environment with:

python3 -m test.pythoninfo

https://docs.python.org/3.9/library/venv.html

--

___
Python tracker 

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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Neel Gore


Neel Gore  added the comment:

zsh 5.8 (x86_64-apple-darwin20.0)
and
macOS Big Sur 11.2.1

This was the normal python dot org installation.

--

___
Python tracker 

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



Re: Change first occurrence of character x in a string - how?

2021-02-14 Thread Chris Green
MRAB  wrote:
> On 2021-02-14 21:14, Chris Green wrote:
> > What's the easiest way to change the first occurrence of a specified
> > character in a string?
> > 
> > E.g. I want to change linux-raid.vger.kernel.org to
> > linux-r...@vger.kernel.org, it's a fairly general requirement of
> > needing to change '.' to '@'.
> > 
> > Alternatively is there an RE 'match' function that would test if
> > linux-r...@vger.kernel.org matches linux-raid.vger.kernel.org? I don't
> > really care if the '.' are all regarded as wild cards, the match will
> > be accurate enough.
> > 
> Use the .replace method. Its 3rd argument is the maximum number of 
> replacements, in this case 1:
> 
> >>> s = 'linux-raid.vger.kernel.org'
> >>> s.replace('.', '@', 1)
> 'linux-r...@vger.kernel.org'

Yes, thank you, simple! :-)

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Change first occurrence of character x in a string - how?

2021-02-14 Thread Chris Green
Gary Herron  wrote:
> 
> On 2/14/21 1:14 PM, c...@isbd.net wrote:
> > What's the easiest way to change the first occurrence of a specified
> > character in a string?
> >
> > E.g. I want to change linux-raid.vger.kernel.org to
> > linux-r...@vger.kernel.org, it's a fairly general requirement of
> > needing to change '.' to '@'.
> >
> > Alternatively is there an RE 'match' function that would test if
> > linux-r...@vger.kernel.org matches linux-raid.vger.kernel.org? I don't
> > really care if the '.' are all regarded as wild cards, the match will
> > be accurate enough.
> >
> The string type has a replace function that does what you want.
> Except you can't change a string -- they are immutable -- so this 
> creates a new string.
> 
> 
> >>> s = 'linux-raid.vger.kernel.org'
> >>> new_s = s.replace('.', '@', 1)
> >>> new_s
> 'linux-r...@vger.kernel.org'
> 
A new string is fine, thank you, that'll do what I need.  Efficiency
isn't a major issue with this.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Change first occurrence of character x in a string - how?

2021-02-14 Thread Gary Herron

The string type has a replace function that does what you want.
Except you can't change a string -- they are immutable -- so this 
creates a new string.



>>> s = 'linux-raid.vger.kernel.org'
>>> new_s = s.replace('.', '@', 1)
>>> new_s
'linux-r...@vger.kernel.org'



On 2/14/21 1:14 PM, c...@isbd.net wrote:

What's the easiest way to change the first occurrence of a specified
character in a string?

E.g. I want to change linux-raid.vger.kernel.org to
linux-r...@vger.kernel.org, it's a fairly general requirement of
needing to change '.' to '@'.

Alternatively is there an RE 'match' function that would test if
linux-r...@vger.kernel.org matches linux-raid.vger.kernel.org? I don't
really care if the '.' are all regarded as wild cards, the match will
be accurate enough.


--
Dr. Gary Herron
Professor of Computer Science
DigiPen Institute of Technology
(425) 895-4418

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


Re: Change first occurrence of character x in a string - how?

2021-02-14 Thread Ned Batchelder
with_at = with_dots.replace(".", "@", 1)

https://docs.python.org/3/library/stdtypes.html#str.replace

--Ned.

On Sunday, February 14, 2021 at 4:18:22 PM UTC-5, Chris Green wrote:
> What's the easiest way to change the first occurrence of a specified 
> character in a string? 
> 
> E.g. I want to change linux-raid.vger.kernel.org to 
> linux...@vger.kernel.org, it's a fairly general requirement of 
> needing to change '.' to '@'. 
> 
> Alternatively is there an RE 'match' function that would test if 
> linux...@vger.kernel.org matches linux-raid.vger.kernel.org? I don't 
> really care if the '.' are all regarded as wild cards, the match will 
> be accurate enough. 
> 
> -- 
> Chris Green 
> ·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Change first occurrence of character x in a string - how?

2021-02-14 Thread MRAB

On 2021-02-14 21:14, Chris Green wrote:

What's the easiest way to change the first occurrence of a specified
character in a string?

E.g. I want to change linux-raid.vger.kernel.org to
linux-r...@vger.kernel.org, it's a fairly general requirement of
needing to change '.' to '@'.

Alternatively is there an RE 'match' function that would test if
linux-r...@vger.kernel.org matches linux-raid.vger.kernel.org? I don't
really care if the '.' are all regarded as wild cards, the match will
be accurate enough.

Use the .replace method. Its 3rd argument is the maximum number of 
replacements, in this case 1:


>>> s = 'linux-raid.vger.kernel.org'
>>> s.replace('.', '@', 1)
'linux-r...@vger.kernel.org'
--
https://mail.python.org/mailman/listinfo/python-list


Re: Change first occurrence of character x in a string - how?

2021-02-14 Thread Dan Stromberg
Check out re.sub's "count" parameter.

https://stackoverflow.com/questions/3951660/how-to-replace-the-first-occurrence-of-a-regular-expression-in-python

On Sun, Feb 14, 2021 at 1:20 PM Chris Green  wrote:

> What's the easiest way to change the first occurrence of a specified
> character in a string?
>
> E.g. I want to change linux-raid.vger.kernel.org to
> linux-r...@vger.kernel.org, it's a fairly general requirement of
> needing to change '.' to '@'.
>
> Alternatively is there an RE 'match' function that would test if
> linux-r...@vger.kernel.org matches linux-raid.vger.kernel.org? I don't
> really care if the '.' are all regarded as wild cards, the match will
> be accurate enough.
>
> --
> Chris Green
> ·
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is email.message.get() case insensitive for the header name?

2021-02-14 Thread MRAB

On 2021-02-14 20:50, Chris Green wrote:

It isn't clear from the documentation. Does email.message.get() care
about the case of the header it's getting?

I checking mailing list mails and the "List-Id:" header is a bit
'mixed', i.e. it can be List-Id:, or List-ID: or list-id:, will
email.message.get("List-Id:", "unknown") find all of them?

According to the specification that it follows, the field names are not 
case-sensitive.


Incidentally, the colon is a separator and not part of the field name.
--
https://mail.python.org/mailman/listinfo/python-list


Change first occurrence of character x in a string - how?

2021-02-14 Thread Chris Green
What's the easiest way to change the first occurrence of a specified
character in a string?

E.g. I want to change linux-raid.vger.kernel.org to
linux-r...@vger.kernel.org, it's a fairly general requirement of
needing to change '.' to '@'.

Alternatively is there an RE 'match' function that would test if
linux-r...@vger.kernel.org matches linux-raid.vger.kernel.org? I don't
really care if the '.' are all regarded as wild cards, the match will
be accurate enough.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Is email.message.get() case insensitive for the header name?

2021-02-14 Thread Chris Green
It isn't clear from the documentation. Does email.message.get() care
about the case of the header it's getting?

I checking mailing list mails and the "List-Id:" header is a bit
'mixed', i.e. it can be List-Id:, or List-ID: or list-id:, will
email.message.get("List-Id:", "unknown") find all of them?

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43225] Add missing value returned by methods on cookiejar

2021-02-14 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

Sorry I left nothing of information.

On 
https://docs.python.org/3/library/http.cookiejar.html?highlight=http%20cookiejar#http.cookiejar.DefaultCookiePolicy.is_blocked
 and 
https://docs.python.org/3/library/http.cookiejar.html?highlight=http%20cookiejar#http.cookiejar.DefaultCookiePolicy.is_not_allowed
 docs mention that is_blocked and is_not_allowed methods "return whether 
*domain*..." but not mention what is return. So I added looking in the code, 
that this methods "return ``True`` whether *domain*..." IMO that is more clear.

--

___
Python tracker 

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



[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Dustin Rodrigues


Dustin Rodrigues  added the comment:

I'm also unable to replicate this. Where did you install Python from? Which 
version of zsh are you running?

--
nosy: +dtrodrigues

___
Python tracker 

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



[issue43225] Add missing value returned by methods on cookiejar

2021-02-14 Thread Emmanuel Arias


Change by Emmanuel Arias :


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

___
Python tracker 

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



[issue43225] Add missing value returned by methods on cookiejar

2021-02-14 Thread Emmanuel Arias


New submission from Emmanuel Arias :

Documentation say that return something but don't specific what
value is returned, and that can be confuse.

--
assignee: docs@python
components: Documentation
messages: 386961
nosy: docs@python, eamanu
priority: normal
severity: normal
status: open
title: Add missing value returned by methods on cookiejar
type: enhancement
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



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-14 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Éric, I considered the possibility of bringing it in python-dev, but thought it 
could be decided in this ticket itself.

1. This was already brought up by multiple Release Managers in Python-dev, and 
some conversation seems to  have happened there previously, especially 
regarding backwards incompatiblity. Ofcourse, we didn't debate the 
implementation, but debating that seems to better to focused here and in OR. On 
wider group, we only to acknowledge that a backwards incompatibility is 
introduced.

2. Other interested core-devs seems to  have given shared their thoughts early 
in the bug too.

So, once I reviewed these, I thought, it seems to okay for us to make a 
decision here.  If there is anything particular you wanted to bring, we could.

--

___
Python tracker 

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



[issue43220] Explicit default required arguments with add_mutually_exclusive_group are rejected

2021-02-14 Thread Keith Smiley


Keith Smiley  added the comment:

Here's an example outside of argparse showing this is caused by the `is` 
comparison with interned string:

```
import sys

short_string = sys.argv[1]
short_default = '1'
long_string = sys.argv[2]
long_default = 'not-interned'

print(f"short comparisons: id1: {id(short_default)} id2: {id(short_string)}, 
eq: {short_default == short_string}, is: {short_default is short_string}")
print(f"long comparisons: id1: {id(long_default)} id2: {id(long_string)}, eq: 
{long_default == long_string}, is: {long_default is long_string}")
```

```
% ./python.exe /tmp/foo.py 1 not-interned
short comparisons: id1: 4523386416 id2: 4523386416, eq: True, is: True
long comparisons: id1: 4524440064 id2: 4523395296, eq: True, is: False
```

--

___
Python tracker 

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



[issue42129] Support resources in namespace packages

2021-02-14 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

For the first two errors, the issue seems to be that CPython includes tests for 
the ResourceReader ABC and asserts that .contents() returns an empty list as 
the default degenerate behavior 
(https://github.com/python/cpython/blob/1b57426e3a7842b4e6f9fc13ffb657c78e5443d4/Lib/test/test_importlib/test_abc.py#L340-L341).
 It appears that the ABC in importlib_resources has for a [very long time 
raised 
FileNotFound](https://github.com/python/importlib_resources/commit/e82b5675b9fef7dd971b796136687f915f7a39ca).

Oh, this is interesting - these ABCs have diverged since their inception; 
here's where [both the empty list behavior and test were introduced in 
cpython](https://github.com/python/cpython/commit/4ac5150e068a3a795ef00465f6dff51747b62b91)
 and [later amended to return an iterable instead of 
iterator](https://github.com/python/cpython/commit/3ab9365dca8438f89b2060cd3eebe00606133dc4).

Brett, is this a divergence worth maintaining? Do you recall if there was a 
reason for changing the ABC during the port to CPython? There's no mention of 
'contents' in issue32248.

My temptation is to go with the implementation as found in importlib_resources 
as it presents a more consistent interface for ResourceReaders (and explicitly 
defaults to raising FileNotFoundError when no implementation for contents is 
present) and thus to change the test to:

```
cpython master $ git diff Lib/test/test_importlib/test_abc.py
diff --git a/Lib/test/test_importlib/test_abc.py 
b/Lib/test/test_importlib/test_abc.py
index d8b9fc89f2..d1c89c183b 100644
--- a/Lib/test/test_importlib/test_abc.py
+++ b/Lib/test/test_importlib/test_abc.py
@@ -338,7 +338,9 @@ def test_is_resource(self):
 self.ins.is_resource('dummy_file')
 
 def test_contents(self):
-self.assertEqual([], list(self.ins.contents()))
+with self.assertRaises(FileNotFoundError):
+self.ins.contents()
+
 
 (Frozen_RRDefaultTests,
  Source_RRDefaultsTests
```

Brett, let me know if you have concern about harmonizing the two 
implementations around this behavior and if you have a strong preference for 
harmonizing toward the CPython implementation instead. Thanks.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue43134] (list have item) instate (item in list)

2021-02-14 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy:  -mark.dickinson

___
Python tracker 

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



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-14 Thread Éric Araujo

Éric Araujo  added the comment:

I also have concerns about specifics of the implementation (see PR) and in 
general the behaviour change in point releases.  Maybe have a thread on 
python-dev?

--

___
Python tracker 

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



[issue43224] Add support for PEP 646 (Variadic Generics) to typing.py

2021-02-14 Thread Matthew Rahtz


Change by Matthew Rahtz :


--
keywords: +patch
nosy: +matthew.rahtz
nosy_count: 1.0 -> 2.0
pull_requests: +23313
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24527

___
Python tracker 

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



[issue43224] Add support for PEP 646 (Variadic Generics) to typing.py

2021-02-14 Thread Matthew Rahtz


Change by Matthew Rahtz :


--
components: Library (Lib)
nosy: mrahtz
priority: normal
severity: normal
status: open
title: Add support for PEP 646 (Variadic Generics) to typing.py
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: mutating a deque whilst iterating over it

2021-02-14 Thread duncan smith
On 13/02/2021 19:12, Dan Stromberg wrote:
> On Sat, Feb 13, 2021 at 10:25 AM duncan smith 
> wrote:
> 
>> On 12/02/2021 03:04, Terry Reedy wrote:
>>> On 2/11/2021 3:22 PM, duncan smith wrote:
>>>
It seems that I can mutate a deque while iterating over it if I
 assign to an index, but not if I append to it. Is this the intended
 behaviour?
>>
>> What I was really wondering was whether the behaviour is as it is
>> because of the implementation or because it's how deques should ideally
>> behave. i.e. In my implementation do I stick strictly to the same API,
>> or allow it to differ? In some places I'm jumping through hoops to stick
>> to the API, and (when it comes to iteration) I'm jumping through
>> different hoops for different types of container (e.g. lists versus
>> deques). BTW, the reason I am implementing these at all is that my
>> containers are on-disk. Cheers.
>>
>> collections.deque appears to take the approach of  "allow everything we
> can based on our implementation, and trust the client not to overuse
> features".
> 
> In fact, in Python, "over abstraction" is often seen as a bad thing, mostly
> because it slows things down so much.
> 
> If you want something more abstracted, you might have a look at:
> https://stromberg.dnsalias.org/~strombrg/linked-list/
> https://pypi.org/project/linked_list_mod/
> 
> (Both URL's are about the same module)
> 
> Note that linked_list_mod is quite a bit slower than a collections.deque.
> Deques use a clever-but-hidden trick to gain a lot of speed - it's really a
> linked list of built in lists, which gives better locality of reference
> that masks CPU caches very happy.  linked_list_mod goes for abstraction and
> simplicity.
> 

I'm basically nicking the trick. I have a basic, single file, on-disk
deque class that doesn't stick strictly to the Python deque API, then a
second class that implements a deque as a Python deque containing
instances of my basic on-disk deque class (with fixed size apart from
the first and last instances). Of course, this could change when I get
to testing / profiling. Cheers.

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


[issue43218] after venv activation "which python3" and sys.path both give base installation instead of venv

2021-02-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

Please do not post screen captures. It makes it difficult for users with 
accessibility software and it makes it hard for people trying to help you to 
copy and paste exactly what you've tried.

I'm unable to duplicate your problem.

[~]$ ps
  PID TTY   TIME CMD
27521 ttys0000:00.07 -zsh
[~]$ which python3
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
[~]$ python3 -m venv .venv
[~]$ source .venv/bin/activate
(.venv) [~]$ which python3
/Users/ericsmith/.venv/bin/python3

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

2021-02-14 Thread Mr Flibble

On 14/02/2021 09:10, Michał Jaworski wrote:

Wow, that thread is entertaining. It seems that neos is one of it’s kind. What 
I hope is that it will support TempleOS.

Going back going back to your original question Mr. Fibble. If ISO standard is 
what you really need to finish your project you can always take up this 
challenge and standardize the language yourself. From what I’ve learned already 
you have enough skills, experience and perseverance to complete such endeavor 
single-handedly.


Ah yes, the good old TempleOS equivalence ploy: typically used by backseat 
programmers and/or trolls to dismiss projects or project authors they deem to 
have no value based on subjective hyperbole rather than valid criticism based 
on objective fact. Usually they lack the skill to embark on such a project 
themselves so their invective tends to stem from feelings of inadequacy.

Make yourself a cup of tea, dear.

/Flibble

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


[issue43217] tkinter style map return value in alt theme

2021-02-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Tested on Python 3.8.6 and 3.8.7+, Windows 10. On 3.8.6 the bug is reproduced, 
on 3.8.7+ all works as expected.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
superseder:  -> ttk style.map function incorrectly handles the default state 
for element options.

___
Python tracker 

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



Re: Sketch

2021-02-14 Thread Mr Flibble

On 14/02/2021 09:10, Michał Jaworski wrote:

Wow, that thread is entertaining. It seems that neos is one of it’s kind. What 
I hope is that it will support TempleOS.

Going back going back to your original question Mr. Fibble. If ISO standard is 
what you really need to finish your project you can always take up this 
challenge and standardize the language yourself. From what I’ve learned already 
you have enough skills, experience and perseverance to complete such endeavor 
single-handedly.


If I standardized the language myself I couldn't call it "Python" as fixing 
Python requires changing it such as to make it unrecognisable as Python.

/Flibble

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


Re: New Python implementation

2021-02-14 Thread Igor Korot
Of course not.
Its like saying "JAVA sucks" without any citation or proof.

And I'm just curious  -  why not use C directly, since he is so great
developer for whatever task he needs to do?

Fun time reading... Hope it will continue.

Thank you.


On Sun, Feb 14, 2021, 1:22 AM Christian Gollwitzer  wrote:

> Am 14.02.21 um 01:19 schrieb Chris Angelico:
> > On Sun, Feb 14, 2021 at 11:14 AM Mr Flibble
> >  wrote:
> >>
> >> On 13/02/2021 23:30, Igor Korot wrote:
> >>> Hi,
> >>> But most importantly - what is the reason for this ?
> >>> I mean - what problems the actual python compiler produce?
> >>>
> >>> Thank you.
> >>
> >> I am creating neos as I need a performant scripting engine for my other
> major project "neoGFX" and I want to be able to support multiple popular
> scripting languages including Python.
> >>
> >
> > Until you have actually produced a (mostly) compatible Python
> > implementation, can you please stop making these repeated and baseless
> > jabs at CPython's performance? You keep stating or hinting that
> > CPython is somehow unnecessarily slow, but unless you have some code
> > to back your claims, this is nothing but mudslinging.
>
> This is a message to all commentators on this list: Mr Flibble is known
> on comp.lang.c++ for making very confident claims and announcements of
> the greatest software product since the invention of the wheel.
>
> He is indeed a capable C++ programmer, but he frequently underestimates
> the work needed for such big projects so that you can easily count them
> as vaporware for now. For example, he created his own "cross-platform,
> modern" GUI toolkit neoGFX[*] just because he thinks that QT is bad (it
> uses non-standard C++). Of course, cross-platform for now means it runs
> on Windows and anything else is far into the future, also the optical
> design looks modern / OK right now, but will look outdated soon. There
> is no evidence that any other designer will join the project to keep the
> look up to date.
>
> He wants that neoGFX is scriptable in Python, but instead of linking
> with CPython, he will write his own Python implementation instead,
> because CPython is slow/not clean/ whatever. He doesn't seem to
> understand that this is an enormous task on its own, because the
> interesting part of a scripting language is the standard library with
> many decade-years of work.
>
> So my advice is to waste your time in this discussion if you find it
> entertaining, but don't expect to have a usable product soon.
>
> Best regards,
>
>Christian
>
> [*] https://github.com/i42output/neoGFX
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: Sketch

2021-02-14 Thread Igor Korot
-- Forwarded message -
From: Igor Korot 
Date: Sat, Feb 13, 2021, 9:20 PM
Subject: Re: Sketch
To: Mr Flibble 
Cc: 


Hi,



On Sat, Feb 13, 2021, 9:12 PM Mr Flibble 
wrote:

> On 14/02/2021 05:04, Mark Lawrence wrote:
> > On Sunday, February 14, 2021 at 5:01:46 AM UTC, Mr Flibble wrote:
> >> CPython *is* the dead parrot.
> >>
> >> It's time for Python to evolve out of the primordial soup.
> >>
> >> /Flibble
>

Is there a proof?
Because I could say that JAVA sucks, but without proof it will be just
words...

Thank you.

>>
> >> --
> >> 
> >
> > Says the bloke(?) who doesn't use mailing lists but does get here
> https://mail.python.org/pipermail/python-list/2021-February/900797.html
>
> I am using Usenet, dear. Apparently posts to comp.lang.python are copied
> to the mailing list which you worship like a god.
>
> /Flibble
>
> --
> 
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-02-14 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

I finished reviewing this PR https://github.com/python/cpython/pull/24297

With the contexts given in W3C recommendation, Synk.io Security Report and 
pattern of usage in libraries like werkzeug and bottle, instead of ignoring 
this and letting this behavior be handled at proxy software level, addressing 
this in stdlib as safe-guard seems like a much better choice to me.

The change and the approach taken by Adam's patch looks good to me. I have 
requested for documentation updates and news entry and it will be merged for 
Python 3.10 and ported to earlier versions.

- Fixing this in 3.10 is going to break behavior of software which relied on 
both "&" and ";" as query parameter separator.  Only a single separator will be 
allowed, and it will default to &. This will be mentioned in documentation.

- As we back-port this to security releases of python, a rationale can be added 
on this change. The documentation or news entry could help developers with 
their plans to upgrade.

--

___
Python tracker 

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



[issue43217] tkinter style map return value in alt theme

2021-02-14 Thread misianne


misianne  added the comment:

Tested W10 Python 3.9.1: map output is OK. It is a problem of Python 3.8.6 
under W7.

--

___
Python tracker 

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



[issue43204] Fix LibTom URL's in hashlib comments

2021-02-14 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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



[issue43204] Fix LibTom URL's in hashlib comments

2021-02-14 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset ae2ff7ba04ad20424db4efcc67246ff27b95 by Miss Islington (bot) 
in branch '3.8':
bpo-43204: Fix LibTomCrypt URL in md5module.c and sha*module.c comments 
(GH-24507) (GH-24516)
https://github.com/python/cpython/commit/ae2ff7ba04ad20424db4efcc67246ff27b95


--
nosy: +corona10

___
Python tracker 

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



Re: Venv behaviour change py3.9

2021-02-14 Thread Barry Scott



> On 14 Feb 2021, at 09:42, Abdur-Rahmaan Janhangeer  
> wrote:
> 
> Greetings all,
> 
> on 3.7 when i do
> 
> $ python -m venv venv
> 
> it creates a venv in venv folder
> 
> but on 3.9 it returns no such file or directory
> 
> os: windows. Any ideas on why the behaviour changes?

I did this on wndows 10 and no error seen:

py -3.9 -m venv venv

Are you running the version of python that you expect?
What does python -V tell you?

Can you cut-n-paste The command and its output?

Barry


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

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


Pygments 2.8 released

2021-02-14 Thread Matthäus G . Chajdas

I'm happy to announce the release of Pygments 2.8. Pygments is a
generic syntax highlighter written in Python.

Pygments 2.8 provides new lexers, various improvements to existing 
lexers and some small styling tweaks. It also introduces significant 
changes to the test infrastructure to make contributions easier and 
improve the overall quality. Please have a look at the changelog 
.


Report bugs and feature requests in the issue tracker:
. Thanks go to all the
contributors of these lexers, and to all those who reported bugs and
waited very patiently for this release.

Download it from , or look at
the demonstration at .

Enjoy,
  Matthäus
___
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


[issue43210] Fix inaccurate byteswap comment in sha512module.c

2021-02-14 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 1b57426e3a7842b4e6f9fc13ffb657c78e5443d4 by Erlend Egeberg 
Aasland in branch 'master':
bpo-43210: Fix byteswap comment in sha512.module.c (GH-24518)
https://github.com/python/cpython/commit/1b57426e3a7842b4e6f9fc13ffb657c78e5443d4


--

___
Python tracker 

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



[issue43210] Fix inaccurate byteswap comment in sha512module.c

2021-02-14 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thank you Erlend!

--
nosy: +corona10
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



[issue43216] Removal of @asyncio.coroutine in Python 3.10

2021-02-14 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +aeros

___
Python tracker 

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



[issue43217] tkinter style map return value in alt theme

2021-02-14 Thread misianne


misianne  added the comment:

My os is windows 7, Python 3.8.6. 
Obviously, I can't test it on 3.9+.

--

___
Python tracker 

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



[issue21567] cannot create multipart alternative message with us-ascii charset

2021-02-14 Thread Irit Katriel


Irit Katriel  added the comment:

Works for me:

Python 3.10.0a5+ (heads/master:bf2e7e55d7, Feb 11 2021, 23:09:25) [MSC v.1928 
64 bit (AMD64)] on win32
>>> from email.mime.multipart import MIMEMultipart
>>> new_msg = MIMEMultipart('alternative')
>>> new_msg.set_charset('us-ascii')
>>>

--
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue28926] subprocess.Popen + Sqlalchemy doesn't wait for process

2021-02-14 Thread Irit Katriel


Irit Katriel  added the comment:

There isn't enough information here to understand what the issue is.

If you are still having this issue in Python 3, please create a new ticket with 
code to reproduce it and information about the system you are using.

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

___
Python tracker 

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



[issue2941] Propagate define to resurce mingw32 compile

2021-02-14 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> out of date
stage: test needed -> resolved
status: pending -> closed

___
Python tracker 

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



[issue43217] tkinter style map return value in alt theme

2021-02-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is our OS and Python version. I cannot reproduce this on Linux, perhaps it 
is OS-specific.

Try to test with the latest Python release. Maybe this bug was fixed in 
issue42328.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue43223] Open Redirection In Python 3.7 & 3.8

2021-02-14 Thread Hamza AVvan


New submission from Hamza AVvan :

The provided version of python distros 3.8.7 and 3.7.4 are vulnerable to open 
redirection while traversing to an existing directory.

# PAYLOAD
http://127.0.0.1:8000//attacker.com/..%2f..%2f..%2f..%2f..%2f../%0a%0d/../.ssh

In this case, the actual path of .ssh was:
http://127.0.0.1:8000/.ssh

Upon visiting the payload URI the python server will respond back with a 
Location header instead of serving the directory contents directly which 
triggers the redirection to attacker.com

Server: SimpleHTTP/0.6 Python/3.8.7

--
components: Windows
files: Capture.PNG
messages: 386945
nosy: hamzaavvan, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Open Redirection In Python 3.7 & 3.8
type: security
versions: Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49808/Capture.PNG

___
Python tracker 

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



[issue43134] (list have item) instate (item in list)

2021-02-14 Thread Masoud Azizi


Masoud Azizi  added the comment:

Linus makes the Linux kernel without expecting benefits.
USA start a war against German and Japan in ww2 without expecting benefits.
Some times we should not think about benefits, just we will do it, if its the 
right thing.
A child never will not born for benefits.
It just born cuz thats only true way to be alive to learn walking well, 
thinking well and speaking well...
With humans, with computers.
Linus never said that to himself forget that it have not benefits.
He continued without having any observer for his work.you know why?
Cuz its the only way to do it without reversing the rules.
And at the end he reversed the rules!

--

___
Python tracker 

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



Venv behaviour change py3.9

2021-02-14 Thread Abdur-Rahmaan Janhangeer
Greetings all,

on 3.7 when i do

$ python -m venv venv

it creates a venv in venv folder

but on 3.9 it returns no such file or directory

os: windows. Any ideas on why the behaviour changes?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New Python implementation

2021-02-14 Thread Christian Gollwitzer

Am 14.02.21 um 01:19 schrieb Chris Angelico:

On Sun, Feb 14, 2021 at 11:14 AM Mr Flibble
 wrote:


On 13/02/2021 23:30, Igor Korot wrote:

Hi,
But most importantly - what is the reason for this ?
I mean - what problems the actual python compiler produce?

Thank you.


I am creating neos as I need a performant scripting engine for my other major project 
"neoGFX" and I want to be able to support multiple popular scripting languages 
including Python.



Until you have actually produced a (mostly) compatible Python
implementation, can you please stop making these repeated and baseless
jabs at CPython's performance? You keep stating or hinting that
CPython is somehow unnecessarily slow, but unless you have some code
to back your claims, this is nothing but mudslinging.


This is a message to all commentators on this list: Mr Flibble is known 
on comp.lang.c++ for making very confident claims and announcements of 
the greatest software product since the invention of the wheel.


He is indeed a capable C++ programmer, but he frequently underestimates 
the work needed for such big projects so that you can easily count them 
as vaporware for now. For example, he created his own "cross-platform, 
modern" GUI toolkit neoGFX[*] just because he thinks that QT is bad (it 
uses non-standard C++). Of course, cross-platform for now means it runs 
on Windows and anything else is far into the future, also the optical 
design looks modern / OK right now, but will look outdated soon. There 
is no evidence that any other designer will join the project to keep the 
look up to date.


He wants that neoGFX is scriptable in Python, but instead of linking 
with CPython, he will write his own Python implementation instead, 
because CPython is slow/not clean/ whatever. He doesn't seem to 
understand that this is an enormous task on its own, because the 
interesting part of a scripting language is the standard library with 
many decade-years of work.


So my advice is to waste your time in this discussion if you find it 
entertaining, but don't expect to have a usable product soon.


Best regards,

  Christian

[*] https://github.com/i42output/neoGFX
--
https://mail.python.org/mailman/listinfo/python-list


[issue43222] Regular expression split fails on 3.6 and not 2.7 or 3.7+

2021-02-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There was a bug in the regular expression engine which caused re.split() 
working incorrectly with zero-width patterns. Note that in your example 
_DIGIT_BOUNDARY_RE.split("10.0.0") returns ['10.0.0'] on Python 2.7 -- the 
result which you unlikely expected.

It was impossible to fix that bug without changing behavior of other functions 
in corner cases and breaking existing code. So we first made re.split() raising 
an exception instead of returning nonsensical result and added warnings for 
some other cases to help users to catch potential bugs in their code and avoid 
ambiguous patterns. You see this in 3.6. In 3.7 we fixed the underlying bug. It 
caused breakage of some user code, but it made regular expressions more 
consistent in long perspective and made zero-width patterns more usable.

In your particular case, if you still need to support Python 2.7 and 3.6, try 
to use re.split() with pattern r'(\D+)' or r'(\d+)' (parentheses are meaningful 
here). It gives almost the same result, except possible prepended and appended 
empty strings.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



Re: Sketch

2021-02-14 Thread Michał Jaworski
Wow, that thread is entertaining. It seems that neos is one of it’s kind. What 
I hope is that it will support TempleOS.

Going back going back to your original question Mr. Fibble. If ISO standard is 
what you really need to finish your project you can always take up this 
challenge and standardize the language yourself. From what I’ve learned already 
you have enough skills, experience and perseverance to complete such endeavor 
single-handedly.

Michał Jaworski
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43222] Regular expression split fails on 3.6 and not 2.7 or 3.7+

2021-02-14 Thread Philip


New submission from Philip :

I am receiving an unexpected behavior in using regular expressions for 
splitting a string. It seems like this error exists in `python 3.6` but not 
`python 2.7` and not `python 3.7+`. Below I have described a minimal example 
with `tox`.

`setup.py`
```
from setuptools import setup
setup(
name='my-tox-tested-package',
version='0.0.1',
install_requires=["pytest"]
)
```

`tests/test_re.py`
```
import re
import pytest

_DIGIT_BOUNDARY_RE = re.compile(
r'(?<=\D)(?=\d)|(?<=\d)(?=\D)'
)

def test():
_DIGIT_BOUNDARY_RE.split("10.0.0")
```

`tox.ini`
```
[tox]
envlist = py27, py36, py37
requires=
  pytest

[testenv]
commands =
pytest {posargs: tests}
```
```
= FAILURES 

_ test 


def test():
>   _DIGIT_BOUNDARY_RE.split("10.0.0")
E   ValueError: split() requires a non-empty pattern match.

tests/test_god.py:9: ValueError
 short test summary info 
==
...

 test session starts 
==
platform linux -- Python 3.7.5, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/probinson/code
collected 1 item

tests/test_re.py .  
  [100%]

 1 passed in 0.00s 
=
 summary 
___
  py27: commands succeeded
ERROR:   py36: commands failed
  py37: commands succeeded

```

--
components: Regular Expressions
messages: 386942
nosy: ezio.melotti, mrabarnett, probinso
priority: normal
severity: normal
status: open
title: Regular expression split fails on 3.6 and not 2.7 or 3.7+
type: crash
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