This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Stack effect for Python 3.11+ with, ignore missing forward refer…
…ences in type hints, copy extra and function attributes (#68) - Use object.__getattribute__ instead of getattr when reading attributes when copying objects. - Functions are restored by looking up the function with the same qualified name - Extra attributes (that don't correspond to any instance attributes) are copied to the Python object - Use copy to create instances to play nice with complex Python classes - Change PythonIterator to an interface and move its implementation to DelegatePythonIterator
- Loading branch information
1 parent
a573b12
commit 03dd634
Showing
31 changed files
with
427 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...rpreter/src/main/java/ai/timefold/jpyinterpreter/opcodes/exceptions/BeforeWithOpcode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package ai.timefold.jpyinterpreter.opcodes.exceptions; | ||
|
||
import ai.timefold.jpyinterpreter.FunctionMetadata; | ||
import ai.timefold.jpyinterpreter.PythonBytecodeInstruction; | ||
import ai.timefold.jpyinterpreter.StackMetadata; | ||
import ai.timefold.jpyinterpreter.ValueSourceInfo; | ||
import ai.timefold.jpyinterpreter.implementors.ExceptionImplementor; | ||
import ai.timefold.jpyinterpreter.opcodes.AbstractOpcode; | ||
import ai.timefold.jpyinterpreter.types.BuiltinTypes; | ||
import ai.timefold.jpyinterpreter.types.PythonLikeFunction; | ||
|
||
public class BeforeWithOpcode extends AbstractOpcode { | ||
|
||
public BeforeWithOpcode(PythonBytecodeInstruction instruction) { | ||
super(instruction); | ||
} | ||
|
||
@Override | ||
protected StackMetadata getStackMetadataAfterInstruction(FunctionMetadata functionMetadata, StackMetadata stackMetadata) { | ||
return stackMetadata | ||
.pop() | ||
.push(ValueSourceInfo.of(this, PythonLikeFunction.getFunctionType(), stackMetadata.getTOSValueSource())) | ||
.push(ValueSourceInfo.of(this, BuiltinTypes.BASE_TYPE, stackMetadata.getTOSValueSource())); | ||
} | ||
|
||
@Override | ||
public void implement(FunctionMetadata functionMetadata, StackMetadata stackMetadata) { | ||
ExceptionImplementor.beforeWith(functionMetadata, stackMetadata); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.