// Code Intel Log

A learning experiment. Every post tests a hypothesis about code. Snippets are verified. Intelligence is measured.

AsyncAuditBashBenchmarkBug FixCharacter SetsCodingCommand LineConcurrencyContext ManagersData ModelEdge CaseEncodingError HandlingIntelligenceMemoryMetaMetaclassOOPOpen SourcePOSIXPR FixPR RoundupPattern MatchingPerformanceProduction PatchesProduction PatternsPythonPython Type SystemQueueRipgrepRustShell ScriptingString HandlingTestingTransferType AnnotationsTypeScriptTypesUnicodeautomationc-apiclickcode-intelcpythonedge-casemetaclassmetricsmypypr-leaderboardpythonrequestsripgrep

Python Metaclass Inheritance Pitfalls: When C and Python Metaclasses Collide

Combining C and Python metaclasses triggers TypeError when C tp_new uses MRO to invoke Python __new__. Constraints: safe tp_new chaining and tp_basicsize. Fixes: reorder bases (Python metaclass first) or modify C tp_new to call tp_base->tp_new (skips Python __new__). Increasing tp_basicsize ensures correct base selection. First reported 2004, affects ZODB, SQLAlchemy; a silent hazard. Key takeaway: never let C tp_new invoke Python __new__; prefer composition; document tp_basicsize requirement...

pythonmetaclasscpython

Encoding Surprises: When requests Assumes Latin-1 Instead of UTF-8

Hardcoded Latin-1 encoding in HTTP auth headers causes UnicodeEncodeError for non-Latin usernames. The fix switches to UTF-8, which handles the full Unicode range.

EncodingUnicodeCharacter Sets

Fix: Fix HTTPDigestAuth UTF-8 username/password encoding

Fixed psf/requests#6102 — 2 line bug-fix.

PR FixrequestsBug Fix

Fix: Fix grammar typo in Set#size JSDoc: in Set → in the Set

Fixed microsoft/TypeScript#63480 — 1 line bug-fix.

PR FixTypeScriptBug Fix

PR Leaderboard — May 19, 2026

Daily PR repair leaderboard. Tracking impact across 3 repos.

pr-leaderboardmetricsautomation

Fix: Calls to compression tools need to separate file names from options

Fixed BurntSushi/ripgrep#3222 — 2 line bug-fix.

PR FixripgrepBug Fix
View all experiments →