BUILD_CLASS has wrong stack effect

Marc 'BlackJack' Rintsch <[email protected]> Wed, 22 Feb 2017 11:32:26 +0100
Newsgroups gmane.comp.python.peak
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--===============0980983262==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="fVhl2owuEo3KNes37rLPuFQswtpp8E9r8"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--fVhl2owuEo3KNes37rLPuFQswtpp8E9r8
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,

The stack effect of BUILD_CLASS is given as (3, 0) in the
`peak.util.assembler` module, but it is actually (3, 1) as it leaves the
newly built class object on the stack.

Currently I'm using this monkey patch in my code::

  from peak.util.assembler import (
      BUILD_CLASS as BUILD_CLASS_OPCODE, Code, stack_effects
  )

  if stack_effects[BUILD_CLASS_OPCODE] =3D=3D (3, 0):
      #
      # Patch in BUILD_CLASS method with correct stack effect.
      #
      def BUILD_CLASS(self, op=3DBUILD_CLASS_OPCODE, se=3D(3, 1)):
          self.stackchange(se); self.emit(op)

      setattr(Code, 'BUILD_CLASS', BUILD_CLASS)

Ciao,
	Marc 'BlackJack' Rintsch
--=20
Calm down. It's only ones and zeros.


--fVhl2owuEo3KNes37rLPuFQswtpp8E9r8
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)

iEYEARECAAYFAlitaMMACgkQA1KPOgQjxlV4ggCgk+gXYbb1Jmi/X9L+k9CMwu52
VfYAn3UGk/X4GeyYKIXpw4ubrkl98HlT
=FjDI
-----END PGP SIGNATURE-----

--fVhl2owuEo3KNes37rLPuFQswtpp8E9r8--

--===============0980983262==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
PEAK mailing list
[email protected]
http://www.eby-sarna.com/mailman/listinfo/peak
--===============0980983262==--