Page MenuHome

PoseBone lists inaccessible object variables when it has custom properties
Closed, ResolvedPublic

Description

System Information
Operating system: Gentoo
Graphics card: AMD Vega 64

Blender Version
Broken: 8c80299fc4493cac640ab4cd56b9bc34f606ee2c, master, 2021-01-08

Short description of error

When a pose bone has a custom property added to it, a inaccessible double object attribute will be added.
It will be listed by dir(bone) but error out if one tries to access it, it will error out and say that it doesn't exist.

If it can't be accessed, it shouldn't be listed by dir at all.

Exact steps for others to reproduce the error

  1. Open the attached .blend file
  2. Run the script
  3. Notice that a python error is thrown

Event Timeline

@Campbell Barton (campbellbarton) Sybren and I took a quick look at it but couldn't find where or why the mysterious double attribute is added.
I'm guessing it is because the custom property is a double, but as you don't access the custom properties this way, it shouldn't be listed as an attribute, no?

Here, from rB623421d58027: RNA * Added support for ID properties, mapped as follows: * IDP Int = RNA Int…:

/* IDP_DOUBLE */
prop = RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);

not sure how that could be excluded from python's dir

The commit message of rB623421d58027 is quite cryptic, and doesn't explain the consequences of the change. I pretty much don't understand anything of it.

To me it makes to sense that the existence of a custom property named "prop" would cause the name "double" to appear in the list of its attributes. There is also no mention of this API change in the 2.92 release notes.

@Brecht Van Lommel (brecht) would you please elaborate on this?

There is also no mention of this API change in the 2.92 release notes.

Is this a regression? Or has this always been like this? That commit is 12 years old...

This thing happens in 2.79 as well.

Oh geesh, I read " Mon Nov 17" in the timestamp and thought "that's not too long ago". My eyes never got to the "2008" part of it. Sorry @Brecht Van Lommel (brecht), I don't mean to be so harsh on your 12-years-younger self!

The relevant RNA docs are here, I've extended them with info relevant to this bug.
https://wiki.blender.org/wiki/Source/Architecture/RNA#ID_Properties