Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change exposed_ value using protocol confiration #202

petmakris opened this issue Dec 13, 2016 · 1 comment

Cannot change exposed_ value using protocol confiration #202

petmakris opened this issue Dec 13, 2016 · 1 comment


Copy link

@petmakris petmakris commented Dec 13, 2016

    from rpyc.utils.server import ThreadedServer

    rpyc_protocol_config = {
        'allow_all_attrs': True,
        'allow_public_attrs': True,
        'allow_exposed_attrs': True,
        'exposed_prefix': '',

    t = ThreadedServer(TouchstoneRemoteService,
                       port = 18861,

In this example it seems that protocol_config does not affect anything. The exposed_ prefix cannot be changed.

The thing is that the method from core/ which checks these options is never called:

    def _check_attr(self, obj, name):

        if self._config["allow_exposed_attrs"]:
            if name.startswith(self._config["exposed_prefix"]):
                name2 = name
                name2 = self._config["exposed_prefix"] + name
            if hasattr(obj, name2):
                return name2
        if self._config["allow_all_attrs"]:
            return name
        if self._config["allow_safe_attrs"] and name in self._config["safe_attrs"]:
            return name
        if self._config["allow_public_attrs"] and not name.startswith("_"):
            return name
        return False

    def _access_attr(self, oid, name, args, overrider, param, default):
        if is_py3k:
            if type(name) is bytes:
                name = str(name, "utf8")
            elif type(name) is not str:
                raise TypeError("name must be a string")
            if type(name) not in (str, unicode):
                raise TypeError("name must be a string")
            name = str(name) # IronPython issue #10 + py3k issue
        obj = self._local_objects[oid]
        accessor = getattr(type(obj), overrider, None)

        print accessor

        if accessor is None:
            name2 = self._check_attr(obj, name)
            if not self._config[param] or not name2:
                raise AttributeError("cannot access %r" % (name,))
            accessor = default
            name = name2
        return accessor(obj, name, *args)

where _check_attr is never actually called.

@coldfix coldfix closed this in 4fbf7e0 Jul 26, 2017
Copy link

@coldfix coldfix commented Jul 26, 2017

You are right. Fix will be in 3.4.4 or greater.

coldfix added a commit that referenced this issue Aug 7, 2017
- Fix refcount leakage when unboxing from cache (#196)
- Fix TypeError when dispatching exceptions on py2 (unicode)
- Respect ``rpyc_protocol_config`` for default Service getattr (#202)
- Support unix domain sockets (#100,#208)
- Use first accessible server in ``connect_by_service`` (#220)
- Fix deadlock problem with logging (#207,#212)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants