Version 3.3.5 released

45 views
Skip to first unread message

Pierre Quentel

unread,
Dec 12, 2017, 3:07:20 PM12/12/17
to brython
I have just published Brython-3.3.5 on Github, npm and PyPI, and updated brython.info.

Besides many bug fixes, the main features in this release are :

  • many improvements to the management of bytes objects and base64 encoding
  • support of built-ins memoryview and vars()
  • the new syntax for DOMNode event binding discussed on this group :
@element.bind("click")
def click(ev):
    ...

is the same as

def click(ev):
    ...
element.bind("click", click)

The complete changelog is below. Thanks to all contributors !

For the next release I plan to work on the main differences with the latest versions of Python (issue #623),
and on the templating engine (module browser.template).

__________

New features
============
- DOMNode objects have a method select_one(selector)
- partial implementation of built-in class memorywiew
- implementation of built-in function vars()
- implement names NULL and UNDEFINED in module javascript (cf. issue #696)
- improve handling of multiple unpackings in function calls (PEP 448)
- improve module browser.template (still work in progress)

Implementation
==============
- package is a javascript reserved word, don't use it as variable name.
- if an aliased name (eg document) is not defined, report NameError with
"document", not "$$document"
- change implementation of events storage
- if called with a single argument, attribute bind() of DOMNode instances can
is a decorator for the bound function (cf. section "Events" in the
documentation).
- if an import fails because of an error in the imported script, print the
latter's traceback, not just ImportError
- change implementation of, and fix bug in assignments to list or tuples.
- improve speed of setattr for "self" in simple classes
- improve speed of comparisons between numbers

Bug fixes
=========
- fix $OpenFile implementation (by DRo)
- bug in DOMNode.unbind()
- bug for Javascript objects accessed as Python dictionaries (eg sys.modules)
- bugs in float subclasses
- bug when using a Python function from a Javascript function (found while
trying to use React.js with Brython)
- bugs in class "object" : __dir__ (add objects's own attributes), __setattr__
(convert aliased names), method names
- bug when aliased names are passed as keyword arguments ; eg for
f(message="ok"), if f is defined with "def f(**kw)", then kw had the key
"$$message" instead of "message"
- bug in py_dom.js : DOMNode.closest(tagName) didn't raise the correct
exception if no tag named tagName is above the DOMNode instance
- for a function "f" defined in class "A", "A.f" is a function, not a method
- add attribute __qualname__ to methods and functions
- bug in Ajax module : attribute "text" is only set if responseType is "" or
"text"

by Jonathan Verner:
- dict initialization from dict objects with null/undefined values
- empty slices of bytes should return b'' not ''.
- slicing beyond end should not return garbage.
- implement find & replace methods of bytes objects.
- bytes.split should throw TypeError when arguments are not byte-like ojects
- add start argument to the bytes.startswith method.
- fix the bytes.upper & add the bytes.lower methods.
- bytes constructor should accept encoding as a keyword argument.
- fix cornercases of base64 encodings.
- make methods in binascii support all bytes-like objects.
- fix altchar handling: don't handle them twice
- make BytesIO return bytes instead of strings.
- exceptions should not error out when no source is given.
- make all base64 unittests pass (except those needings subprocess).
- make rich comparisons retry with reflected op if NotImplemented returned

Issues
#682 : from my_module import *
#686 : aliased names are not correctly set in exec()
#687 : struct.pack/unpack() confused about int sizes with native size /
alignment
#690 : issue accessing global variables in the console
#691 : instance variable's __dict__ not clearing
#695 : AttributeError: object has no attribute __ARGV
#697 : invalid Syntax error show wrong line in console demo
#698 : class __mro__ is a list rather than a tuple
#699 : exceptions thrown printing various dunder attributes
#700 : http.cookies is poorly optimized/runs poorly
#701 : type of empty tuple slices (by Jonathan Verner)
#708 : f("data"=1) should raise a SyntaxError
#720 : "call stack exceeded" for comparison operators using functions
#723 : Weird Console List Issue

Brython site
============
- add WebAudio demo (page gallery/drums.html)

Github site
===========
- mention the tutorial for Android apps in README.md

Demos
=====
- add vue.js demo in the gallery
- use make_dist.py to generate setup/data/demo.html from www/demo.html
- improve solitaire, SVG Pie Chart demos
- rewrite some demos : PEP8 compliance, use of f-strings or format() instead
of %, new syntax for event binding

Standard distribution
=====================
- in ajax.py, replace argument "async" by "asynchr", to avoid conflicts when
"async" becomes a keyword
- move highlight module from site-packages to browser package

Documentation
=============
- add sections in FAQ
- rewrite a part of the documentation with the new binding syntax with
decorators


Reply all
Reply to author
Forward
0 new messages