[issue13361] getLogger does not check its argument

2011-11-07 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file23622/issue13361_check.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13361] getLogger does not check its argument

2011-11-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 8c719e106694 by Vinay Sajip in branch 'default':
Merged fix for #13361 from 3.2.
http://hg.python.org/cpython/rev/8c719e106694

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13361] getLogger does not check its argument

2011-11-07 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

I've uploaded two proposals:
 - first with isinstance(name, str)
 - second which is more duck-friendly

Personally, I like ducks.

--
stage: needs patch - patch review
Added file: http://bugs.python.org/file23623/issue13361_dont_check.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13361] getLogger does not check its argument

2011-11-07 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

btw, changeset a3ba905447ba does not fix the case for:

import logging
log = logging.Logger(any)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13361] getLogger does not check its argument

2011-11-07 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

@Florent: Sorry, I didn't see your patch, for some reason. But I would say:

1. I agree that where I put the check (logging.getLogger) does not catch the 
case where someone instantiates the logger directly (using 
logging.Logger(any)), but users aren't supposed to instantiate loggers directly 
anyway - this would not result in a working logger. The check is in the same 
place where (in 2.7) we check for Unicode and encode to bytes.

2. I don't want to be too liberal in accepting logger names, since they are 
intended to mean a place in the application. So, accepting anything other 
than text does not seem right to me - so str for 3.x, str or unicode for 2.x.

3. I thought a single test (passing in a invalid type) would be sufficient for 
the logging code, ISTM adding tests with lots of types is actually testing 
isinstance ;-)

4. I didn't notice your patch, and hence goofed in raising a ValueError instead 
of (correctly as you had it) a TypeError. I will rectify this.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13361] getLogger does not check its argument

2011-11-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 60dd1568bbd1 by Vinay Sajip in branch '2.7':
Closes #13361: Raise correct exception type.
http://hg.python.org/cpython/rev/60dd1568bbd1

New changeset bc05c11b340e by Vinay Sajip in branch '3.2':
Closes #13361: Raise correct exception type.
http://hg.python.org/cpython/rev/bc05c11b340e

New changeset fb73fe5d0ab1 by Vinay Sajip in branch 'default':
Closes #13361: Merge fix from 3.2.
http://hg.python.org/cpython/rev/fb73fe5d0ab1

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13361] getLogger does not check its argument

2011-11-07 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

FYI, the following changesets were also for this issue.  They had the wrong 
issue number (#13661, which doesn't actually exist so no big deal), which is 
why they didn't show up in this issue automatically.


New changeset 5f3b7528b144 by Vinay Sajip in branch '2.7':
Closes #13661: Check added for type of logger name.
http://hg.python.org/cpython/rev/5f3b7528b144

New changeset a3ba905447ba by Vinay Sajip in branch '3.2':
Closes #13661: Check added for type of logger name.
http://hg.python.org/cpython/rev/a3ba905447ba

--
nosy: +eric.snow

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13361] getLogger does not check its argument

2011-11-06 Thread Florent Xicluna

New submission from Florent Xicluna florent.xicl...@gmail.com:

 import logging
 log = logging.getLogger(any)
Traceback (most recent call last):
  File stdin, line 1, in module
  File ./Lib/logging/__init__.py, line 1730, in getLogger
return Logger.manager.getLogger(name)
  File ./Lib/logging/__init__.py, line 1114, in getLogger
self._fixupParents(rv)
  File ./Lib/logging/__init__.py, line 1142, in _fixupParents
i = name.rfind(.)
AttributeError: 'builtin_function_or_method' object has no attribute 'rfind'
 log = logging.getLogger(any)
 log.error(It should not create this logger)
It should not create this logger


--
components: Library (Lib)
messages: 147196
nosy: flox
priority: normal
severity: normal
stage: needs patch
status: open
title: getLogger does not check its argument
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13361] getLogger does not check its argument

2011-11-06 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +vinay.sajip

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com