Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • erp5 erp5
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 142
    • Merge requests 142
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedinexedi
  • erp5erp5
  • Merge requests
  • !2145

load bytes objects directly as bytes

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Xiaowu Zhang requested to merge xiaowu.zhang/erp5:fix/mix_data into master Aug 14, 2025
  • Overview 35
  • Commits 12
  • Pipelines 0
  • Changes 11

While upgrade instance from python2 to python3, i found when read old BigFile object such as Data Stream, it raise error below

  Module erp5.component.document.erp5_version.BigFile, line 105, in getData
    return btree.read(0, len(btree))
  Module erp5.component.module.erp5_version.BTreeData, line 182, in read
    return b''.join(self.iterate(offset, size))
TypeError: sequence item 0: expected a bytes-like object, str found

It's because the old data created when in python2 is firstly loaded as string

but for PersistentString, we're sure that it's bytes, let's load directly as bytes to avoid useless conversion.

in this MR, we also clean some codes

Related MR: https://lab.nexedi.com/nexedi/erp5-bin/-/merge_requests/12

Edited Oct 02, 2025 by Xiaowu Zhang
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix/mix_data
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7