Comments (2)
原因其实不复杂,不过我也绕晕了一会儿,问题在于Python2和Python3中的types.MethodType
的作用不一样了。在ipython
中通过help
来列出二者的用法,可以发现是不同的:
# Python 2
Help on class instancemethod in module __builtin__:
class instancemethod(object)
| instancemethod(function, instance, class)
|
| Create an instance method object.
# Python 3
class method(object)
| method(function, instance)
|
| Create a bound instance method object.
在Python2中,你可以把一个方法作为“实例方法”绑定到一个类的身上,并且之后从该类创建的实例的对应方法,都将是你所指定的这个方法。但是Python3中不同了,如果你将instance指定成一个类,那么Python3会将这个类视为一个实例,为其绑定一个bind
方法,那么此时的bind
实质上就成了这个类的类方法。所以你在new_bind函数中拿到的self就是类本身了(cls)。
解决这个问题很简单。我创建了一个新的PR,相信你一看就懂了。
from pysocket.
感谢!终于把这个问题给解决了。
from pysocket.
Related Issues (20)
- 希望支持多用户版的SS HOT 13
- proxy有说明文档吗 HOT 1
- 貌似udp有问题 HOT 10
- 用socket.py使XX-Net做ss的前置无效 HOT 1
- 在多账户系统下,黑名单内的端口无法使用 HOT 4
- 把socket.py放进去以后没有起作用 HOT 2
- 使用源码启动的SS服务器如何开机启动 HOT 1
- archlinux放置到/usr/lib/python3.6/site-packages/shadowsocks/ 不起作用 HOT 1
- 急急急,我是码盲。。。
- 搬瓦工系统自带ss,放在哪里? HOT 3
- 软件根目录在哪 HOT 3
- 黑白名单中如何添加一个范围内的端口
- 可以用在shadowsocks-manager上吗 HOT 1
- Limit Clients 如何使用? HOT 8
- 一个客户端断开了以后,另一个客户端永远连不上 HOT 43
- 希望支持不同的port 有不同的限制数 HOT 2
- 【小问题】同一个设备,连着ss server播放Youtube,4G和wifi之间切换会出现中断
- 关于Limit_Clients udp 在 shadowsocks 下的bug。 HOT 3
- 大神好 hi能否给个联系方式
- 不支持SSR对吗? HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysocket.