Xqt created this task.
Xqt added projects: Pywikibot, Pywikibot-RfCs.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  **Feature summary**:
  Python `logging.exception()` uses `exc_info=True` by default [1] which means 
the traceback is shown whereas Pywikibot `pywikibot.logging.exception()` (also 
available as `pywikibot.exception()`) uses `tb=False` by default. There is not 
significant difference between `pywikibot.exception()` and `pywkibot.error()` 
except that the pywikibot variant of exception is able to get the exception 
from sys.exc_info() and the msg parameter may be omitted.
  
  The behaviour of `pywikibot.exception()` should be in sync with the 
underlying Python implementation and the `tb` parameter should be `True` by 
default.
  
  **Use case(s)**:
  Currently there is no difference between pywikibot.error() and 
pywikibot.exception() if the exception is given as message:
  
    import pywikibot
    try:
        1/0
    except Exception as e:
        pywikibot.error(e)
    
    ERROR: division by zero
    
    try:
        1/0
    except Exception as e:
        pywikibot.error(e, exc_info=True)
    
    ERROR: division by zero
    Traceback (most recent call last):
      File "<pyshell#7>", line 2, in <module>
    ZeroDivisionError: division by zero
  
    try:
        1/0
    except Exception as e:
        pywikibot.exception(e)
    
    ERROR: division by zero
    
    try:
        1/0
    except Exception as e:
        pywikibot.exception(e, tb=True)
    
        
    ERROR: division by zero
    Traceback (most recent call last):
      File "<pyshell#11>", line 2, in <module>
    ZeroDivisionError: division by zero
    
    try:
        1/0
    except Exception as e:
        pywikibot.exception(e, exc_info=True)
    
    ERROR: division by zero
    Traceback (most recent call last):
      File "<pyshell#13>", line 2, in <module>
    ZeroDivisionError: division by zero
  
  **Benefits**:
  The behaviour for `pywikibot.error()` should be differ from 
`pywikibot.exception()` and follow the underlying Python implementation..
  
  I propose to change this behaviour with Pywikibot 8 because ist is a breaking 
change but I don't see any important impact to have a longer deprecation period 
here.
  
  [1] https://docs.python.org/3/library/logging.html#logging.exception

TASK DETAIL
  https://phabricator.wikimedia.org/T306762

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Xqt
Cc: Aklapper, pywikibot-bugs-list, Zabe, Rubin16, Meno25, Strainu, xSavitar, 
Huji, Mpaa, Framawiki, matej_suchanek, JJMC89, Xqt, Jyoo1011, JohnsonLee01, 
SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont, 
Dvorapa, Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to