Git Product home page Git Product logo

Comments (2)

JustinCappos avatar JustinCappos commented on September 16, 2024

We seem to have a bunch of problems with dylink. Someone needs to clean
up this module...

On Fri, Jun 20, 2014 at 5:44 AM, aaaaalbert [email protected]
wrote:

dylink caches modules that have already been imported in (the same or
another) source file so that ciruclar imports don't become a problem, see
SeattleTestbed/seattlelib_v2#127
SeattleTestbed/seattlelib_v2#127. This works
as expected when running Repy, but fails under repyportability.

Here's a test case that shows what happens. (I'll make a unit test out of
it too). testlib1 just defines an error class, which is imported and
raised in a function of testlib2, which in turn is called by the main
program, where we try to catch that exception.

This is testlib1.r2py

class Lib1Error(Exception):
"""The exception we are trying to catch."""

##################################

This is testlib2.r2py

lib1 = dy_import_module("testlib1.r2py")

def raise_lib1error():
raise lib1.Lib1Error

################################

This is the main program

lib1 = dy_import_module("testlib1.r2py") # defines the exception
lib2 = dy_import_module("testlib2.r2py") # raises it

try:
lib2.raise_lib1error()
except lib1.Lib1Error:

Branch taken in Rep

log("Could catch!\n")
except Exception, e:

Branch taken under Repyportability

log("Nargh, caught", repr(e), "and not", repr(lib1.Lib1Error()))

To check the repyportability behavior, add this to the main program:

from repyportability import *
add_dy_support(locals())

The issue is related to #27
#27 and possibly
Seattle's #1422, SeattleTestbed/seattlelib_v2#125
SeattleTestbed/seattlelib_v2#125,
SeattleTestbed/repy_v2#22
SeattleTestbed/repy_v2#22 (why's a RepyV2
issue btw?), and SeattleTestbed/repy_v2#55
SeattleTestbed/repy_v2#55.


Reply to this email directly or view it on GitHub
#28.

from portability.

aaaaalbert avatar aaaaalbert commented on September 16, 2024

Two unit tests are available to check the behavior of the module cache now:

  • SeattleTestbed/seattlelib_v2@8ae85a4 has a Repy version of the test, and shows the correct behavior (the imported exception can be caught)
  • 61fd57e adds repyportability to the RepyV2 test, and exhibits the problem described above

from portability.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.