Ryan Gonzalez | 18 Apr 00:42 2014
Picon

Alternatives to multiple inheritance

I’m writing a scripting language using RPython. I have a base class for all my objects. Now, I have an exception object. The exception object needs to derive from my base class in order for me to use polymorphism inside the interpreter. However, it also needs to derive from the Exception class to be throwable. My code looked kind of like this:

class BaseObject(object): pass class MyException(BaseObject, Exception): ...

However, upon trying to compile the code, I got this error:

[translation:ERROR] AssertionError: multiple inheritance only supported with _mixin_: <class 'bolt.objects.BoltException'> [translation:ERROR] Processing block: [translation:ERROR] block <at> 122 is a <class 'rpython.flowspace.flowcontext.SpamBlock'> [translation:ERROR] in (bolt.main:10)parse_and_run [translation:ERROR] containing the following operations: [translation:ERROR] v0 = simple_call((type interpreter)) [translation:ERROR] --end--

bolt.objects.BoltException is my exception class. If I remove the Exception base, I get this:

[translation:ERROR] AssertionError [translation:ERROR] Processing block: [translation:ERROR] block <at> 9 is a <class 'rpython.flowspace.flowcontext.SpamBlock'> [translation:ERROR] in (bolt.main:4)run_file [translation:ERROR] containing the following operations: [translation:ERROR] v0 = simple_call((function create_file), p_0, ('r')) [translation:ERROR] v1 = getattr(v0, ('read')) [translation:ERROR] v2 = simple_call(v1) [translation:ERROR] v3 = simple_call((function parse_and_run), v2) [translation:ERROR] v4 = getattr(v0, ('close')) [translation:ERROR] v5 = simple_call(v4) [translation:ERROR] --end--

The only thing about multiple inheritance and RPython I found was this.

My current idea is to have my base object derive from Exception instead of nothing. I was wondering if there’s a better solution, however.


--
Ryan
If anybody ever asks me why I prefer C++ to C, my answer will be simple: "It's becauseslejfp23( <at> #Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated."

_______________________________________________
pypy-dev mailing list
pypy-dev <at> python.org
https://mail.python.org/mailman/listinfo/pypy-dev
Ronan Lamy | 16 Apr 16:21 2014
Picon

Re: RPython as a separate package

Le 16/04/14 05:59, Bogdan Opanchuk a écrit :
> Hi Benjamin,
>
> Thank you, I've seen it in the repo. But one still cannot install it
> as a separate package, say, in CPython, and it's not even available as
> a package in the PyPy itself (it's only used at build stage, as far as
> I understand). Are there any plans to complete the splitting and make
> it a standalone package?

There are no firm plans, but it is still a goal. There are a few issues 
to solve first, though:

* Unbundling pytest and py lib
* Cleaning up and splitting the docs between PyPy and RPython
* Deciding what to do with the repository
Armin Rigo | 16 Apr 10:45 2014

Re: RPython as a separate package

Hi Bogdan,

On 16 April 2014 06:59, Bogdan Opanchuk <mantihor <at> gmail.com> wrote:
> it's not even available as a package in the PyPy itself

What do you mean?  "rpython" is the name of the top-level directory
we're talking about, with "__init__.py" and everything.  It is a
regular package.

A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
pypy-dev <at> python.org
https://mail.python.org/mailman/listinfo/pypy-dev
Bogdan Opanchuk | 16 Apr 06:31 2014
Picon

RPython as a separate package

Hello,

I would like to use the RPython toolchain in my project. The problem
is, RPython is currently hidden inside PyPy and therefore not readily
available. I found this thread
https://mail.python.org/pipermail/pypy-dev/2012-October/010602.html
which goes as far as to state "Note that the fact of splitting this is
not up to discussion, however, how we go about it is.". So, what is
the status of the splitting? Was this idea eventually abandoned?
Armin Rigo | 15 Apr 12:55 2014

OS/X

Hi OS/X'ers,

I see in rpython/translator/platform/darwin.py that we use only
"clang" as the compiler on OS/X.  There was some discussion in #pypy,
as well as a proposal from Andrew Dalke to upgrade the gcc on the OS/X
buildbot, which go along the lines of "clang is not necessarily always
better than gcc on OS/X".  So I would like that the RPython toolchain
supports both choices.

Please don't discuss clang-vs-gcc endlessly here, I'm sure there are
people who think that clang is better than gcc and others that have
the opposite view and both camps have strong opinions -- that's not
the point and I don't honestly care.  This e-mail is *only* about
supporting both choices.

Could someone on OS/X check that we can use gcc to translate pypy's?
This can be checked by trying out a smaller example, like
rpython/translator/goal/targetnopstandalone.py .  What fixes do you
need in darwin.py?  Or simply pass some environment variable? Thanks!

A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
pypy-dev <at> python.org
https://mail.python.org/mailman/listinfo/pypy-dev
Mike Mezeul | 15 Apr 05:59 2014

PyPy support for PPC processors

Hello;

 

Does anyone have any insight as to why the support for Power PC processors has stalled?

 

I’m specifically interested in knowing if it was technical hurdles or just lack of interest. If technical, could someone please elaborate on what the issues are?

 

Thanks,

Mike Mezeul

 

 

Michael Mezeul

Senior Director R&D

ADVA Optical Networking

2301 North Greenville Avenue, Suite 300

Richardson, TX 75082, USA

Phone: +1.972.759.1216

Fax:     +1.972.759.1201

Mobile: +1.214.448.9239

e-mail: mmezeul <at> advaoptical.com

 

www.advaoptical.com

Let’s ADVANCE

 

ADVA Optical Networking SE is a European stock corporation ("Societas Europaea") with registered offices at Maerzenquelle 1-3, D-98617 Meiningen, Germany * CEO: Brian L. Protiva, Chief Officers: Dr. Christoph Glingener, Christian Unterberger, Jaswir Singh * Chairman of the Supervisory Board: Anthony Maher * AG Jena HRB 508155 * VAT No. DE 175 446 349

 

 

_______________________________________________
pypy-dev mailing list
pypy-dev <at> python.org
https://mail.python.org/mailman/listinfo/pypy-dev
Naftali Harris | 10 Apr 21:05 2014
Picon

CPython compatibility in the fractions module

Hi everyone,

I'd like to report a compatibility issue between CPython and PyPy in the fractions module.  In short, CPython coerces Fraction objects into int's in strings formatted with "%d", but PyPy throws a TypeError.  Here's an example reproducing this:

~/Downloads/pypy-2.2.1-linux64/bin$ ./pypy 
Python 2.7.3 (87aa9de10f9c, Nov 24 2013, 18:48:13)
[PyPy 2.2.1 with GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``<arigato> fijal: I'm sure there
is tons of unspecified context information that I should ideally also be aware
of''
>>>> from fractions import Fraction
>>>> print "%d" % Fraction(1, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type for int(): 'Fraction'
>>>> 
~/Downloads/pypy-2.2.1-linux64/bin$ python
Python 2.7.3 (default, Feb 27 2014, 19:37:34) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fractions import Fraction
>>> print "%d" % Fraction(1, 1)
1
>>> 

Thanks for the great work you all do!

Naftali
_______________________________________________
pypy-dev mailing list
pypy-dev <at> python.org
https://mail.python.org/mailman/listinfo/pypy-dev
matti picus | 9 Apr 22:10 2014
Picon

msvc and floating point compiler flags

looking at this test failure
http://buildbot.pypy.org/summary/longrepr?testname=test_math&builder=own-win-x86-32&build=86&mod=jit.backend.x86.test.test_zmath
which tests that atan2(0.23/1.23) == 1.3.... via OP_FLOAT_EQ(double value, double value)
OP_FLOAT_EQ is a compiler define to (a == b), which is tricky with double values.
Here is a nice discussion of the issue on MSVC
http://www.gamasutra.com/view/news/167402/Indepth_Intermediate_floatingpoint_precision.php
The link even has a flow chart for choosing msvc or intel compiler flags.
The test passes if I add /fp:fast to the msvc compile flag
Would anyone object if I add this to the default MSVC flags?

FWIW, the "fast" is misleading, apparently it can be slower than the default for some cases.
Matti
_______________________________________________
pypy-dev mailing list
pypy-dev <at> python.org
https://mail.python.org/mailman/listinfo/pypy-dev
Carl Friedrich Bolz | 9 Apr 18:15 2014
Picon
Picon

"aborts" in unroll

Hi all,

I found the reason why unroll often produces uncounted "aborts". It's
the constructor here:

class InvalidLoop(JitException):
    """Raised when the optimize*.py detect that the loop that
    we are trying to build cannot possibly make sense as a
    long-running loop (e.g. it cannot run 2 complete iterations)."""

    def __init__(self, msg='?'):
        debug_start("jit-abort")
        debug_print(msg)
        debug_stop("jit-abort")
        self.msg = msg

unroll uses InvalidLoop internally, which does not propagate up. I am
fixing that on my branch.

Cheers,

Carl Friedrich
Dima Tisnek | 9 Apr 20:29 2014
Picon

should os.fdopen(fd-of-a-directory, "r") succeed?

it fails on py 2.7 (with a bug), fails correctly in py 3.3 and
succeeds in pypy 2.2:

>>>> import os
>>>> os.open("/", os.O_RDONLY)
3
>>>> os.fdopen(3, "r")
<open file '<fdopen>', mode 'r' at 0x0000000105b71830>
>>>> f = _
>>>> f.read(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 21] Is a directory: '<fdopen>'
>>>>
anatoly techtonik | 4 Apr 17:04 2014
Picon

Python Execution Contexts Ch.3 - High Level

Hi,

I am proud to present the picture that shows various
places where Python code can be executed. 51k
picture that worths 1k of words.


Trying to figure out different entrypoints for executing
Python code and context available for Python code
in these entrypoints. Would be nice to get some
feedback on this diagram. I hope it is still better than
text.


I didn't compare __builtins__ - that's the task better
done with HTML table generator, but there are two
questions about Python/PyPy console context.

pypy-2.2.1 >>> dir()
['__builtins__', '__doc__', '__name__']

python-2.7.6 >>> dir()
['__builtins__', '__doc__', '__name__', '__package__']


1. Why there is __package__ that can not be anything
    but None?

I consider this to be a bug in Python 2.x, because I don't
see how this should be used in console, so I don't mind
that PyPy doesn't implement it. But then comes another
question.

2. If PyPy doesn't implement useless console context
    properties like __package__, why there is __doc__
    entry that can not be anything but None?


_______________________________________________
pypy-dev mailing list
pypy-dev <at> python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Gmane