Issue903723

classification
Title: fixes for test_new
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: bzimmer, ellisj, nobody, pedronis
Priority: normal Keywords: patch

Created on 2004-02-24.20:56:28 by ellisj, last changed 2005-07-04.18:30:09 by bzimmer.

Files
File name Uploaded Description Edit Remove
new-patch.txt ellisj, 2004-02-24.20:56:29
Messages
msg2365 (view) Author: Jonathan Ellis (ellisj) Date: 2004-02-24.20:56:28
Sanity checking of the closure supplied via new.function.

Note that test_closure(g, None, TypeError) still fails
because jython raises a ValueError instead of a
TypeError.  (Because Jython sees None and turns it into
a null PyObject[], indistinguishable from no closure at
all.)  Fixing this would require changing the signature
of the PyFunction constructor to take PyObject
(PyTuple) instead of PyObject[] which would require a
substantial rewrite of CodeCompiler's
visitFunctionDef/makeClosure methods.  It's doable but
since the new module is deprecated in Python 2.3 anyway
I don't think it's really worth all that trouble to
match CPython's exact exception in a fairly obscure case.
msg2366 (view) Author: Samuele Pedroni (pedronis) Date: 2004-02-25.03:26:50
Logged In: YES 
user_id=61408

Good.  The validation stuff is good, but you don't want the
check to be inside the constructor. I will take care of this
detail when I merge this. Anyway some of this logic should
migrate to new.function.__new__ because new.function is a
type in 2.2 not a builtin function. Not that I was asking
for that.
msg2367 (view) Author: Nobody/Anonymous (nobody) Date: 2004-02-25.04:45:47
Logged In: NO 

I almost didn't put the validate call in the constructor but
I looked at the CPython source and it always does the checks
so I imitated it in that respect.
msg2368 (view) Author: Samuele Pedroni (pedronis) Date: 2004-02-25.14:05:07
Logged In: YES 
user_id=61408

I see, but CPython code tries to avoid segmentation faults
and memory corruption, OTOH for code called from java if
someone passes a null or something wich will fail a cast,
they will get a NullPointerException or Cast* which is fine,
like it happens also with other java libraries

What we are interested in is to avoid that Jython side code
sees /can trigger such exceptions.
msg2369 (view) Author: Brian Zimmer (bzimmer) Date: 2005-07-04.18:30:09
Logged In: YES 
user_id=37674

This patch no longer fixes test_new against the current tip.  I'm rejecting 
it in anticipation of working patch.
History
Date User Action Args
2004-02-24 20:56:28ellisjcreate