473,773 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

bytecode non-backcompatibili ty

Hi,

I've been using Python for about 2 years now, for my honours project and
now my postgrad project. I must say that I am loving it more and more
now. From my knowledge, Python bytecodes are not back-compatible. I must
say that my technical background isn't strong enough but is there any
good reason for not being back-compatible in bytecodes?

My problem is not about pure python modules or libraries but the problem
is with 3rd party libraries with C bindings (not python pure). It means
that with every upgrade of python, I have to reinstall all my 3rd party
libraries which can be quite a bit of work...

I do hope this problem will be sorted out some day.

Cheers
Maurice
Jul 19 '05
33 2029
Mike Meyer wrote:
Maurice LING <ma*********@ac m.org> writes:

The idea of having to release the program or library as source files
does ring alarms in many executives in corporate world. Less freezing
the modules (which renders it platform dependent) or using Jython
(which is not possible when C extensions are involved), there is no
middle grounds in CPython for distribution without source codes.

You're right - and byte codes *as they exist now* aren't an acceptable
middle ground, either. The problem isn't that the interpreter might
change (that can be defeated by distributing the interpreter with the
bytecode files), but that the byte code can be decompiled to get your
Python source back. See <URL:
http://www.crazy-compilers.com/decompyle/ > for an example.


I know that bytecodes can be decompiled back to python source. Similarly
Java class files can be decompiled back to Java source files quite
easily. IANAL, however, I do think that reverse engineering can be seen
as a purposeful act in the eyes of law. I remembered that EU Council
Directive 9/250/ECC does explicits the allowable scope of decompilation
(for interoperabilit y, preserving expression of ideas, achieving
performance of objectives).

For companies, I think it is touchy to ask permission to release the
source codes even though they may be alright with releasing the same
Java JAR file into the community.

We do know that regardless of whatever methods of compilation there may
be, if some genius is willing to spend sufficient time to crack a
program. Even if he has to read the binary codes, it will still break.
But that is a wilfull act rather than just looking at the source codes
when it is distributed with it. It's just like picking up your money
from the ground if you had dropped it as compared to pickpocketing you
as compared to hold you at knife point and robbing you...... Same end
result but it is viewed differently in the eyes of law and morals.


Selling byte codes to someone who's worried about shipping source is
selling them snake oil. I think it's unprofessional, at best.

<mike

Jul 19 '05 #21
Maurice LING wrote:
Now I understand that Python bytecodes are only dealing with pure python
source codes. However, the same question lies, how can it (set of
bytecodes) be made stable, like Java bytecodes, which are pretty stable?
Perhaps a better question will be, what techniques Java VM designers
use that enables Java class files (and JAR files) to be stable and
usable across versions that is lacking in Python?


The Java class file format is not any more stable than the Python .pyc
format - I think every major release of the JVM has changed details
in the class file format.

The difference is that the newer JVMs accept old class files, by
means of separate loader code for each class file version that was
ever released (and very possibly also support for class file versions
that were never released).

The same approach would be possible in Python, but nobody has
contributed code to do so. It is unlikely that future Python
versions will provide such compatibility with the current byte
code format, either, unless somebody steps forward and volunteers
to maintain that compatibility.

Maintaining this backwards compatibiltiy is a tedious and boring
task, given the many much easier alternatives, so that volunteers are
unlikely to jump in. Sun manages to provide the compatibility by
paying somebody to actually maintain it.

Regards,
Martin
Jul 19 '05 #22
Maurice LING wrote:
technicalities are wrong but situation remains unchanged.


For C modules, it is very likely that new versions of Python
will continue to break the ABI, by changing the layout of
structures.

The most straight-forward way to deal with it as a sysadmin
or user is to install multiple versions of Python on a single
machine. If Fink considers python2.4 as a replacement for
python2.3, then this is a flaw in Fink. In Debian, there is
a python package, which currently depends on python2.3.
Sometime in the future, it will depend on python2.4. Users
which update will then get python2.4, however, python2.3
will remain installed and usable, with all the extension
modules that were installed for it.

Regards,
Martin
Jul 19 '05 #23

"Maurice LING" <ma*********@ac m.org> wrote in message
news:d4******** **@domitilla.ai oe.org...
From a technical perspective, I can accept that .pyc files are private
and temporary. To a certain extend, it does helps development cycle.
Every time I amend my source codes, I just run it without having to
consider or needing to re-compile the source files. From a user perspective, source code is the run-time program. The idea of having to release the program or library as source files does
ring alarms in many executives in corporate world.


I understand that people use Python while resisting its purpose and design.
But I also understand that it is *their* responsibilty to hide their code,
which may possibly mean not using Python, or which may mean developing
proprietary methods to translate to something designed to *not* be
readable. For all we know, some of the developers have been paid to do
exactly that -- and not talk about it.

Python is *designed* for human readability. That is one of its big
features! The same also seems somewhat true for CPython's bytecodes,
especially when disassembled with the dis module that comes with the
interpreter. You even get all the object names included in the code
object.

Terry J. Reedy

Jul 19 '05 #24
Martin v. Löwis wrote:
Maurice LING wrote:
technicalitie s are wrong but situation remains unchanged.

For C modules, it is very likely that new versions of Python
will continue to break the ABI, by changing the layout of
structures.

The most straight-forward way to deal with it as a sysadmin
or user is to install multiple versions of Python on a single
machine. If Fink considers python2.4 as a replacement for
python2.3, then this is a flaw in Fink. In Debian, there is
a python package, which currently depends on python2.3.
Sometime in the future, it will depend on python2.4. Users
which update will then get python2.4, however, python2.3
will remain installed and usable, with all the extension
modules that were installed for it.

Regards,
Martin


Fink does not consider python2.4 to be a replacement for python2.3. In
fact, you can install python2.2, 2.3 and 2.4 in the same machine with
Fink. It will maintain 3 sets of libraries as /sw/lib/python2.2,
/sw/lib/python2.3 and /sw/lib/python2.4. The chore is that when say Fink
installs python2.4, all the libraries in /sw/lib/python2.3/site-packages
have to be re-installed into /sw/lib/python2.4/site-packages, one by
one. There is no simple way of doing that... which makes any system
admin needing to re-install 50 3rd party libraries into
/sw/lib/python2.4/site-packages a big task, as well as satisfying the
necessary dependencies.

So if C extension API (or whatever that is really called) is stable, the
system admin can just copy all of /sw/lib/python2.3/site-packages into
/sw/lib/python2.4/site-packages and it should work. From what you've
said, it seems that this isn't possible. So my alternative solution is
that PyPI have a mechanism to maintain what had been installed in the
site-package directory and to download the libraries and install into
the new site-package directory...

What do you think?

Cheers
maurice
Jul 19 '05 #25

"Maurice LING" <ma*********@ac m.org> wrote in message
news:d4******** **@domitilla.ai oe.org...
So my alternative solution is that PyPI have a mechanism to maintain what
had been installed in the site-package directory and to download the
libraries and install into the new site-package directory... What do you think?


I doubt anyone disputes that upgrades are more hassle than we would like.
My main point was that freezing CPython's technology is not the solution.
Any other upgrade helper that you can contribute will be welcome.

Terry J. Reedy

Jul 19 '05 #26
Maurice LING wrote:
So if C extension API (or whatever that is really called) is stable, the
system admin can just copy all of /sw/lib/python2.3/site-packages into
/sw/lib/python2.4/site-packages and it should work.
It would be counter-productive to make it stable, as this would render
certain desirable changes impossible. Backwards compatibility on C API
(source) level is a goal, binary compatibility within a 2.x release
is a goal, binary compatibility across 2.x releases is not.

[automatically install a set of packages] What do you think?


That would certainly be possible. Contributions are welcome.

Regards,
Martin
Jul 19 '05 #27
Terry Reedy wrote:
I doubt anyone disputes that upgrades are more hassle than we would like.
My main point was that freezing CPython's technology is not the solution.
Any other upgrade helper that you can contribute will be welcome.

Terry J. Reedy


So there is no way of releasing a close-source application written in
Python?

Forget about reverse engineering or decompiling, things like EU Council
Directive, Berne Convention , and legislation of individual countries
are to be used and argued for handling what decompilation is allowed or
not allowed. It does make a difference between looking at the codes
when it is given and performing an act of decompilation to look at the
codes. As mentioned in one of my postings, it may be analogous to the
difference between you dropping some cash on the ground and I take it,
and I performing the act of pickpocketing and take your money.

I am not advocating close source in any sense and I believe the choice
of open or close source distribution is individual's and corporate's rights.

Cheers
Maurice
Jul 19 '05 #28
Martin v. Löwis wrote:
[automatically install a set of packages]
What do you think?

That would certainly be possible. Contributions are welcome.

Regards,
Martin


I've emailed to catelog-sig mailing list and is still waiting to hear
something. Currently, I have no idea of the structure of PyPI. I hope I
can hear from them soon and generate some starting points...

Maurice
Jul 19 '05 #29
Maurice LING wrote:
I doubt anyone disputes that upgrades are more hassle than we would
like. My main point was that freezing CPython's technology is not the
solution. Any other upgrade helper that you can contribute will be
welcome.


So there is no way of releasing a close-source application written in
Python?


I fail to see the relationship between the statement and your question.

Again, whether or not the C API is frozen has nothing to do with
whether or not the bytecode format is frozen. So any implication
from not freezing the C API to not being able to ship byte-code
only is invalid.

As for only shipping byte code: sure, that is certainly possible,
and people do that all the time.

Regards,
Martin
Jul 19 '05 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3038
by: Jonathan Neve | last post by:
Hi all! I'm wondering what would be involved in making a Delphi to bytecode compiler... Does anyone have any experience writing compilers, that could give me some advice? The reason I think this would be useful, is that it would broaden the scope of the Java platform, enabling many languages to be used (just like .NET). There are already several langages (e.g. Java, Jython, Groovy, and perhaps others), but it would be nice to have a...
34
2479
by: Jacek Generowicz | last post by:
I have a program in which I make very good use of a memoizer: def memoize(callable): cache = {} def proxy(*args): try: return cache except KeyError: return cache.setdefault(args, callable(*args)) return proxy which, is functionally equivalent to
46
6290
by: Jon Perez | last post by:
Can one run a 1.5 .pyc file with the 2.x version interpreters and vice versa? How about running a 2.x .pyc using a 2.y interpreter?
6
4917
by: Benjamin Scherrey | last post by:
I'm curious as to how difficult it would be to take a string that contains compiled bytecode, load it into memory, give it a function name then execute that function. I'm thinking of a database that contains compiled objects that I can load and execute. I'm also curious as to what level of grainularity this would work - module, class, class method, function? Anyone tried to do this before? Obviously dependencies are a consideration but I'm...
1
3110
by: Bo Jacobsen | last post by:
I have a number of files compiled to bytecode using py_compile.compile(). The .pyc files can be invoked by python directly ($python file.pyc), but "loading" them by execfile just throws an exception ? Any suggestions Bo.
11
2511
by: M1st0 | last post by:
where I can find the grammar of python bytecode ? ( better if is in BCF ).
0
2029
by: Andrew Lambert | last post by:
Hi, I've been trying to compile perl scripts into bytecode. Now, from what I understand I can use either perlcc -B script.pl or perl -MO=bytecode script.pl to do this (whats the difference between these two methods anyway ?). If I use perl -MO=bytecode, both versions I've tried dump seemingly random ascii characters to the screen. ActivePerl-5.8 completes with 'script syntax OK' while the standard redhat perl completes with 'No...
4
2225
by: Ben | last post by:
Does anyone have any experience using the TrueType bytecode interpreter to display fonts in PHP under Windows? I'm running Windows XP, PHP 4.3.11, GD 2.0.28 with FreeType enabled. It all works fine, but it's using the FreeType anti-aliased hinting rather than the clear Windows non-antialiased (bytecode interpreter?) hinting. I'm looking into converting my weather graph generator (at http://harvest.com/w.cgi), which now uses the Win32 API...
0
1204
by: sxanth | last post by:
>What puzzles me, though, are bytecodes 17, 39 and 42 - surely these aren't >reachable? Does the compiler just throw in a default 'return None' >epilogue, with routes there from every code path, even when it's not >needed? If so, why? Hi. pyc (http://freshmeat.net/projects/pyc) can already remove that unused code since June.
4
3299
by: kwatch | last post by:
Hi, It is possible to get bytecode from code object. Reversely, is it possible to create code object from bytecode? ex. ## python code (not a module) pycode = '''\ print "<ul>\n" for item in items:
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.