[issue38981] better name for re.error Exception class.

2020-09-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
type: security -> enhancement

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2020-09-16 Thread Sourabh


Change by Sourabh :


--
nosy: +sourabh025
type: enhancement -> security

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-09 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

> RECompileError, REParseError, RESyntaxError, REError, CompileError, 
> ParseError, SyntaxError or Error, 

> Many modules [...] have an exception named just Error

RECompileError, REParseError, RESyntaxError, REError, CompileError, ParseError 
are all fine with me. 

SyntaxError would be super confusing IMHO.
Remember the StackTrace does not get the fully qualified name, so it would be 
hard to distinguish from a SyntaxError with the Python Syntax.

aifc, binhex, sunau, uu, xdrlib might be removed with PEP 594, And I find  
`Error` not informative enough. It suffers from the same issues as above, as 
stack traces do not have the full qualified name. 

I would also add that being able to search and find all occurrences of a given 
exceptions is useful, and that Error is too generic.

Let me know your choice and I can rename.

--

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not sure about the new name. "re" is an abbreviation, so if include it in 
the exception name it should be "RE". I am not sure what name is better: 
RECompileError, REParseError, RESyntaxError, REError, CompileError, ParseError, 
SyntaxError or Error.

json raises JSONDecodeError, ElementTree raises ParseError, other xml modules 
raise ExpatError, csv raises Error, configparser raises subclasses of Error.

Many modules (at least 18: aifc, binhex, concurrent.futures, configparser, 
copy, cvs, ftplib, locale, mailbox, shutil, sqlite, sunau, test.support, uu, 
wave, webbrowser, xdrlib, xmlrpc.client) have an exception named just Error for 
module-specific errors.

--

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-07 Thread Matthias Bussonnier


Change by Matthias Bussonnier :


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

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-07 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Strictly speaking not all of those _need_ to be touched given the old name is 
always going to exist for backwards compatibility.  But I agree that we should 
update them as part of this regardless.

I'd go forward with a PR.

The only fallout I expect a change like this to have on users is in the very 
odd test scenario where someone has hardcoded the error name in a string.  That 
is rare, especially for an re.error which is generally not an expected 
exception.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-07 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

Thanks Serhiy, 

Here is a rough idea of how many places would be touched by renaming in the 
`re` module:

https://github.com/Carreau/cpython/commit/59e4c5150c842f849ff3a9ba8a94df1df7a5eb1c
 (50 additions and 42 deletions.). 

I haven't found any places that need changes in the C code, and need to polish 
documentation, rebuild and run the test suite before sending a PR.

--

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +easy

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Reopened after discussing on Python-ideas: 
https://mail.python.org/archives/list/python-id...@python.org/thread/64NHNY6RD4HQWBSBV6J7XIN7UAHNTQBR/.

--
resolution: not a bug -> 
stage: resolved -> needs patch
status: closed -> open
type:  -> enhancement
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



[issue38981] better name for re.error Exception class.

2019-12-05 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

Thanks for the advice I've done that ! 

Have a good day.

--

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Since it affects more than one module I suggest to discuss the idea about 
renaming exceptions of the Python-Ideas maillist first. Until different 
decision be made I am closing. Personally I think this is a duplicate of just 
discussed and rejected idea.

--
status: open -> closed

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-05 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

Most of the module specific classes are `Error`, not `error`, at least with an 
uppercase E you know it's a class. 

if a novice sees :

> error: missing ), unterminated subpattern at position 0

It will be relatively tough or them to figure out that `error` is the type of 
the exception. 

Also it's not because something works that you can't improve it ...

--
status: closed -> open

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also the discussion about renaming json.loads(): 
https://mail.python.org/archives/list/python-id...@python.org/thread/EJTIVQ2ZFSVHALTLRGFCOMOYGZYMKGQU/

--

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is common practice that the module specific exception is called just 
"error". There is nothing wrong with this.

I do not see a need to introduce a different alias.

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



[issue38981] better name for re.error Exception class.

2019-12-05 Thread Matthias Bussonnier


New submission from Matthias Bussonnier :

better error/exception name for re.compile error. 

Currently the error raise by re.compile when it fails to compile is `error` 
defined in sre_constants.py: 

```
class error(Exception):
"""Exception raised for invalid regular expressions.

```

This is quite disturbing as most exception start with an uppercase and have a 
tiny bit more descriptive name. 

Would it be possible to have it renamed as something more explicit like 
`ReCompileError`, and still keeping the potential `error` alias as deprecated ?

--
components: Regular Expressions
messages: 357867
nosy: ezio.melotti, mbussonn, mrabarnett
priority: normal
severity: normal
status: open
title: better name for re.error Exception class.

___
Python tracker 

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