[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2021-06-03 Thread James Gerity


James Gerity  added the comment:

The cause of DeprecationWarning sometimes [1] not being issued is I believe 
because in string_parser.c [2] the module is explicitly set to NULL and the 
filename will be '' or '' or somesuch, which eventually that 
ends up being normalized to something that isn't '__main__'. 

Not sure if this is stating the obvious and I don't see any general solution 
short of adding a filter for the special filenames, but I caught wind of this 
in #python on Libera, got curious, and thought I'd share what I learned here. 
I've also attached a gdb session showing how changing the filename affects this 
behavior.

Reproducing this in debug/dev contexts is definitely fraught, since the warning 
behavior is different.

[1] The given compile() sample, at the REPL, when using -c, or when piping 
input via stdin are the ones I know about
[2] 
https://github.com/python/cpython/blob/f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970/Parser/string_parser.c#L19-L20

--
nosy: +SnoopJeDi2
Added file: https://bugs.python.org/file50091/gdb_deprecationwarning_session.txt

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2021-06-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Ah, there is a difference between debug and regular builds. I tested with the 
debug build.

--
components: +Interpreter Core -Windows
nosy: +ncoghlan, vstinner -paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2021-06-02 Thread Aaron Gallagher


Aaron Gallagher <_...@habnab.it> added the comment:

This is definitely not windows-specific. On macos:

$ python3.9
Python 3.9.4 (default, Apr  5 2021, 01:47:16)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '\s'
'\\s'

--
nosy: +habnabit

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

OK, verified issue with installed 3.9.0a5, which must have different warning 
settings.

>From a file, 1 warning.
:1: DeprecationWarning: invalid escape sequence \d

Interactively, no warning.

>>> compile("'\d'", "", "eval")
 at 0x0263842DFC90, file "", line 1>
>>>

--

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-10 Thread Numerlor


Numerlor  added the comment:

The newest 64 bit release from python.org via the executable installer.

--

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

On Win 10, with recently compiled 3.7.7+ and 3.9.0a5+, I get 4 warnings also.

>>> import warnings
>>> compile("'\d'", "", "eval")
:1: DeprecationWarning: invalid escape sequence \d
:1: DeprecationWarning: invalid escape sequence \d
 at 0x00A65DC0, file "", line 1>
>>> warnings.resetwarnings()
>>> compile("'\d'", "", "eval")
:1: DeprecationWarning: invalid escape sequence \d
:1: DeprecationWarning: invalid escape sequence \d
 at 0x00A66190, file "", line 1>

Numerior, what 3.8 binaries are you running?  I suspect that this should be 
closed as 'out of date'.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-05 Thread Numerlor


Numerlor  added the comment:

In what environment was that ran in?
The issue seems to exist in all the different environments that are easily 
available to me (win7, win10, linux under docker and on repl.it)

--

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I get it printed two times.

Actually I get it printed four times: two time when compile the test script 
(use r"'\d'" or "'\\d'" to get rid of them), and other two times when call 
compile() inside a script.

$ ./python issue40199.py 
issue40199.py:3: DeprecationWarning: invalid escape sequence \d
  compile("'\d'", "", "eval")
issue40199.py:5: DeprecationWarning: invalid escape sequence \d
  compile("'\d'", "", "eval")
:1: DeprecationWarning: invalid escape sequence \d
:1: DeprecationWarning: invalid escape sequence \d

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-05 Thread Michal Laboš

New submission from Michal Laboš :

The current warning filter seems to filter out the compile time 
DeprecationWarnings that get triggered on invalid escape sequences:

import warnings

compile("'\d'", "", "eval")
warnings.resetwarnings()
compile("'\d'", "", "eval")


results in one
:1: DeprecationWarning: invalid escape sequence \d
being printed

--
messages: 365825
nosy: Michal Laboš
priority: normal
severity: normal
status: open
title: Invalid escape sequence DeprecationWarnings don't trigger by default
type: behavior
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