hunk.code_window:     return NULL;
     }
     std::shared_ptr<Array> array;
     if (PyList_Check(value)) {
       Status s = SerializeSequences(std::vector<PyObject*>({value}), &array);
       if (!s.ok()) {
         // If this condition is true, there was an error in the callback that
         // needs to be passed through
         if (!PyErr_Occurred()) {
           PyErr_SetString(NumbufError, s.ToString().c_str());
  
hunk.labels: keep keep keep keep replace keep keep keep keep keep
hunk.after_edit:     int32_t recursion_depth = 0;
       Status s = SerializeSequences(std::vector<PyObject*>({value}), recursion_depth, &array);
  
hunk.file_path: python/src/pynumbuf/numbuf.cc
hunk.type: replace
file: #ifndef NUMBUF_DICT_H
  #define NUMBUF_DICT_H
  
  #include <arrow/api.h>
  
  #include "sequence.h"
  
  namespace numbuf {
  
  /*! Constructing dictionaries of key/value pairs. Sequences of
      keys and values are built separately using a pair of
      SequenceBuilders. The resulting Arrow representation
      can be obtained via the Finish method.
  */
  class DictBuilder {
  public:
    DictBuilder(arrow::MemoryPool* pool = nullptr)
      : keys_(pool), vals_(pool) {}
  
    //! Builder for the keys of the dictionary
    SequenceBuilder& keys() { return keys_; }
    //! Builder for the values of the dictionary
    SequenceBuilder& vals() { return vals_; }
  
    /*! Construct an Arrow StructArray representing the dictionary.
        Contains a field "keys" for the keys and "vals" for the values.
  
        \param list_data
          List containing the data from nested lists in the value
          list of the dictionary
  
        \param dict_data
          List containing the data from nested dictionaries in the
          value list of the dictionary
    */
    std::shared_ptr<arrow::StructArray> Finish(
      std::shared_ptr<arrow::Array> key_tuple_data,
      std::shared_ptr<arrow::Array> val_list_data,
      std::shared_ptr<arrow::Array> val_tuple_data,
      std::shared_ptr<arrow::Array> val_dict_data);
  
  private:
    SequenceBuilder keys_;
    SequenceBuilder vals_;
  };
  
  }
  
  #endif
  