[issue8720] undo findsource regression/change

2010-06-16 Thread holger krekel

holger krekel holger.kre...@gmail.com added the comment:

Seems the inspect.getsourcefile regression now is in the RC1 of Python2.7 as 
well.  I suggest to apply the getsourcefile.patch patch which was attached 
from David.  I tested it and it works fine for Python2.7 and Python3.1.

--
status: open - pending
versions: +Python 2.7, Python 3.3

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



[issue8720] undo findsource regression/change

2010-06-16 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I've applied the patch to trunk in r82039, to py3k in r82041, and 3.1 in r82042.

Holger, I'm not really familiar with the linecache module and its uses, so I'm 
not sure what your proposal is aimed at.  Perhaps you could flesh out your 
proposal in a new ticket?

--
assignee:  - r.david.murray
resolution:  - fixed
stage: patch review - committed/rejected
status: pending - closed
versions:  -Python 3.3

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



[issue8720] undo findsource regression/change

2010-05-21 Thread holger krekel

holger krekel holger.kre...@gmail.com added the comment:

David, your getsourcefile.patch looks fine (and better than mine) to me.

--

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



[issue8720] undo findsource regression/change

2010-05-21 Thread holger krekel

holger krekel holger.kre...@gmail.com added the comment:

Well, maybe we could introduce a linecache.setlines function to give
the linecache module control over its internal caching and data
handling. What do you think?

--

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



[issue8720] undo findsource regression/change

2010-05-20 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Holger, what do you think of this alternate patch that instead makes 
getsourcefile smarter?  It's a simpler patch and doesn't change the API, and 
your tests (suitably modified) pass.

--
stage:  - patch review
Added file: http://bugs.python.org/file17423/getsourcfile.patch

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



[issue8720] undo findsource regression/change

2010-05-15 Thread holger krekel

holger krekel holger.kre...@gmail.com added the comment:

Thanks for helping with this!  Attached is a patch that adds a keyword 
check=True to getsourcefile so that findsource can defer existence-checking 
until after cache lookup.  Eventually, findsource will still raise an IOError 
if it can't find the source file and cannot recover the source from cache.  The 
patch mainly consists of adding a number of tests to specify the (refined) 
behaviour of findsource and getsourcefile.  

best, holger

--
keywords: +patch
Added file: http://bugs.python.org/file17350/findsource.patch

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



[issue8720] undo findsource regression/change

2010-05-14 Thread holger krekel

New submission from holger krekel holger.kre...@gmail.com:

Somewhere between python 3.0.1 and 3.1.2 the behaviour of inspect.findsource 
changed: it does not find the source code anymore for a code object whose 
filename/source is in the linecache.cache because instead of the previous::

file = getsourcefile(object) or getfile(object)

it only does now::

file = getsourcefile(object) 

IMO it is enough if findsource() raises if it can't eventually discover the 
source code - i don't see the need to do this ahead.

In any case, the r312 findsource version requires an ugly work around within 
py.test in order for it to continue to be able to use the inspect module with 
dynamically compiled code.  The underlying issue is that at code-compile time 
no sensible (PEP302 compliantly loaded) module can be constructed because this 
is only known at exec-time but this is not part of the test tool API and is 
done somewhere in user code. 

Proposed fix: revert to r301 behaviour and add back or getfile(object) to the 
first line of inspect.findsource()

--
components: Library (Lib)
messages: 105776
nosy: benjamin.peterson, hpk
priority: normal
severity: normal
status: open
title: undo findsource regression/change
type: behavior
versions: Python 3.1

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



[issue8720] undo findsource regression/change

2010-05-14 Thread Trundle

Trundle andy-pyt...@hammerhartes.de added the comment:

This was changed due to issue #4050.

--
nosy: +Trundle

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



[issue8720] undo findsource regression/change

2010-05-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +r.david.murray
versions: +Python 3.2

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



[issue8720] undo findsource regression/change

2010-05-14 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

As I remember it, #4050 was in turn caused by a change elsewhere in the 
codebase to using linecache where it wasn't used before.

Regardless, though, the problem is that findsource doesn't produce an error 
when called on a binary module. It thinks it found the source code, but what it 
found was binary data.

@holger: can you suggest an alternate fix to #4050?

--

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